Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test #75

Merged
merged 2 commits into from
Aug 29, 2024
Merged

Test #75

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions aquapi_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ packages:
aquapi: !include common/aquapi.yaml
# ota_https: !include common/ota_https.yaml
dallas: !include common/temperature_dallas.yaml
optical: !include common/optical.yaml
binary: !include common/binary.yaml
# ir_receiver: !include common/ir_receiver.yaml
# dht: !include common/dht.yaml
Expand All @@ -24,5 +25,6 @@ packages:
ezo_pmp: !include common/ezo_pmp.yaml
# ezo_pmp_extra: !include common/ezo_pmp_extra.yaml
ezo_pmp_duo: !include common/ezo_pmp_duo.yaml
# dac: !include common/dac.yaml
# ezo_commands: !include common/ezo_commands.yaml
# debug: !include common/debug.yaml
77 changes: 9 additions & 68 deletions common/binary.yaml
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"};
}
33 changes: 33 additions & 0 deletions common/dac.yaml
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
71 changes: 71 additions & 0 deletions common/optical.yaml
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"};
}