generated from esphome/esphome-project-template
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
4 changed files
with
115 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,87 +1,28 @@ | ||
substitutions: | ||
# Optical_1 | ||
opticalLowPin: "33" # yellow | ||
opticalHighPin: "32" # blue | ||
# AUX_1 - DAC | ||
auxPin: "26" # yellow | ||
|
||
# Water Level | ||
update_water: "60s" | ||
|
||
esphome: | ||
on_boot: | ||
priority: 200 | ||
then: | ||
- component.update: water_level | ||
substitutions: | ||
binary_1: "13" # yellow | ||
binary_2: "27" # blue | ||
|
||
binary_sensor: | ||
# Optical Sensor - LOW (yellow) | ||
- platform: gpio | ||
id: os_low | ||
# disabled_by_default: true | ||
id: binary_1 | ||
pin: | ||
number: ${opticalLowPin} | ||
number: ${binary_1} | ||
inverted: true | ||
mode: | ||
input: true | ||
pullup: true | ||
name: "Optical Sensor: Low" | ||
name: "Binary 1" | ||
filters: | ||
- delayed_on_off: 30ms | ||
on_state: | ||
then: | ||
component.update: water_level | ||
|
||
# Optical Sensor - HIGH (blue) | ||
- platform: gpio | ||
id: os_high | ||
# disabled_by_default: true | ||
id: binary_2 | ||
pin: | ||
number: ${opticalHighPin} | ||
number: ${binary_2} | ||
inverted: true | ||
mode: | ||
input: true | ||
pullup: true | ||
name: "Optical Sensor: High" | ||
name: "Binary 2" | ||
filters: | ||
- delayed_on_off: 30ms | ||
on_state: | ||
then: | ||
component.update: water_level | ||
|
||
# Additional Pin 1 | ||
- platform: gpio | ||
id: aux_1 | ||
disabled_by_default: true | ||
pin: | ||
number: ${auxPin} | ||
inverted: true | ||
mode: | ||
input: true | ||
pullup: true | ||
name: Aux 1 | ||
filters: | ||
- delayed_on_off: 30ms | ||
|
||
text_sensor: | ||
# Water Level | ||
- platform: template | ||
icon: mdi:waves-arrow-up | ||
name: "Water Level" | ||
id: water_level | ||
update_interval: "${update_water}" | ||
lambda: |- | ||
if(id(os_high).state == true && id(os_low).state == true) { | ||
// Water Level is High | ||
return {"High"}; | ||
} | ||
if(id(os_high).state == false && id(os_low).state == false) { | ||
// Water Level is Low | ||
return {"Low"}; | ||
} | ||
if(id(os_high).state == false && id(os_low).state == true) { | ||
// Water Level is Normal | ||
return {"Normal"}; | ||
} else { | ||
return {"Uknown or Error"}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# TODO | ||
substitutions: | ||
dac_1: "26" # yellow | ||
dac_2: "25" # blue | ||
|
||
binary_sensor: | ||
# DAC Pin 1 | ||
- platform: gpio | ||
id: aux_1 | ||
disabled_by_default: true | ||
pin: | ||
number: ${dac_1} | ||
inverted: true | ||
mode: | ||
input: true | ||
pullup: true | ||
name: DAC 1 | ||
filters: | ||
- delayed_on_off: 30ms | ||
|
||
# DAC Pin 1 | ||
- platform: gpio | ||
id: aux_1 | ||
disabled_by_default: true | ||
pin: | ||
number: ${dac_2} | ||
inverted: true | ||
mode: | ||
input: true | ||
pullup: true | ||
name: DAC 1 | ||
filters: | ||
- delayed_on_off: 30ms |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
substitutions: | ||
# Optical_1 | ||
opticalLowPin: "33" # yellow | ||
opticalHighPin: "32" # blue | ||
|
||
# Water Level | ||
update_water: "60s" | ||
|
||
esphome: | ||
on_boot: | ||
priority: 200 | ||
then: | ||
- component.update: water_level | ||
|
||
binary_sensor: | ||
# Optical Sensor - LOW (yellow) | ||
- platform: gpio | ||
id: os_low | ||
# disabled_by_default: true | ||
pin: | ||
number: ${opticalLowPin} | ||
inverted: true | ||
mode: | ||
input: true | ||
pullup: true | ||
name: "Optical Sensor: Low" | ||
filters: | ||
- delayed_on_off: 30ms | ||
on_state: | ||
then: | ||
component.update: water_level | ||
|
||
# Optical Sensor - HIGH (blue) | ||
- platform: gpio | ||
id: os_high | ||
# disabled_by_default: true | ||
pin: | ||
number: ${opticalHighPin} | ||
inverted: true | ||
mode: | ||
input: true | ||
pullup: true | ||
name: "Optical Sensor: High" | ||
filters: | ||
- delayed_on_off: 30ms | ||
on_state: | ||
then: | ||
component.update: water_level | ||
|
||
text_sensor: | ||
# Water Level | ||
- platform: template | ||
icon: mdi:waves-arrow-up | ||
name: "Water Level" | ||
id: water_level | ||
update_interval: "${update_water}" | ||
lambda: |- | ||
if(id(os_high).state == true && id(os_low).state == true) { | ||
// Water Level is High | ||
return {"High"}; | ||
} | ||
if(id(os_high).state == false && id(os_low).state == false) { | ||
// Water Level is Low | ||
return {"Low"}; | ||
} | ||
if(id(os_high).state == false && id(os_low).state == true) { | ||
// Water Level is Normal | ||
return {"Normal"}; | ||
} else { | ||
return {"Uknown or Error"}; | ||
} |