mirror of
https://github.com/nuttytree/ESPHome-Devices.git
synced 2024-08-30 18:12:19 +00:00
More basement bathroom updates
This commit is contained in:
parent
4fe781d7ef
commit
6e63a90ff7
@ -17,7 +17,7 @@ esphome:
|
|||||||
binary_sensor:
|
binary_sensor:
|
||||||
- !include common/binary_sensor/status.yaml
|
- !include common/binary_sensor/status.yaml
|
||||||
- platform: gpio
|
- platform: gpio
|
||||||
id: light_toggle
|
id: light_button
|
||||||
pin:
|
pin:
|
||||||
number: 12
|
number: 12
|
||||||
mode: INPUT_PULLUP
|
mode: INPUT_PULLUP
|
||||||
@ -25,25 +25,17 @@ binary_sensor:
|
|||||||
then:
|
then:
|
||||||
- switch.toggle: light
|
- switch.toggle: light
|
||||||
- platform: gpio
|
- platform: gpio
|
||||||
id: fan_toggle
|
id: fan_button
|
||||||
pin:
|
pin:
|
||||||
number: 3
|
number: 3
|
||||||
mode: INPUT_PULLUP
|
mode: INPUT_PULLUP
|
||||||
on_press:
|
on_press:
|
||||||
then:
|
then:
|
||||||
- fan.toggle: fan
|
- fan.toggle: the_fan
|
||||||
- platform: homeassistant
|
|
||||||
id: motion
|
|
||||||
name: Motion
|
|
||||||
entity_id: binary_sensor.basement_bathroom_motion
|
|
||||||
- platform: homeassistant
|
|
||||||
id: door
|
|
||||||
name: Door
|
|
||||||
entity_id: binary_sensor.basement_bathroom_door
|
|
||||||
|
|
||||||
fan:
|
fan:
|
||||||
- platform: binary
|
- platform: binary
|
||||||
id: fan
|
id: the_fan
|
||||||
output: fan_output
|
output: fan_output
|
||||||
name: "Basement Bathroom Fan"
|
name: "Basement Bathroom Fan"
|
||||||
|
|
||||||
@ -55,17 +47,11 @@ output:
|
|||||||
sensor:
|
sensor:
|
||||||
- !include common/sensor/uptime.yaml
|
- !include common/sensor/uptime.yaml
|
||||||
- !include common/sensor/wifi.yaml
|
- !include common/sensor/wifi.yaml
|
||||||
- platform: homeassistant
|
|
||||||
id: humidity
|
|
||||||
name: Humidity
|
|
||||||
entity_id: sensor.basement_bathroom_humidity
|
|
||||||
- platform: homeassistant
|
|
||||||
id: median_humidity
|
|
||||||
name: Median Humidity
|
|
||||||
entity_id: sensor.basement_bathroom_median_humidity
|
|
||||||
|
|
||||||
status_led:
|
status_led:
|
||||||
pin: 0
|
pin:
|
||||||
|
number: 0
|
||||||
|
inverted: true
|
||||||
|
|
||||||
switch:
|
switch:
|
||||||
- !include common/switch/restart.yaml
|
- !include common/switch/restart.yaml
|
||||||
@ -74,7 +60,6 @@ switch:
|
|||||||
name: "Basement Bathroom Light"
|
name: "Basement Bathroom Light"
|
||||||
icon: mdi:lightbulb
|
icon: mdi:lightbulb
|
||||||
pin: 13
|
pin: 13
|
||||||
inverted: false
|
|
||||||
|
|
||||||
text_sensor:
|
text_sensor:
|
||||||
- !include common/text_sensor/version.yaml
|
- !include common/text_sensor/version.yaml
|
||||||
|
@ -24,25 +24,119 @@ i2c:
|
|||||||
|
|
||||||
binary_sensor:
|
binary_sensor:
|
||||||
- !include common/binary_sensor/status.yaml
|
- !include common/binary_sensor/status.yaml
|
||||||
- platform: gpio
|
|
||||||
name: Basement Bathroom Motion
|
|
||||||
device_class: motion
|
|
||||||
pin:
|
|
||||||
number: D0
|
|
||||||
mode: INPUT_PULLDOWN_16
|
|
||||||
- platform: gpio
|
- platform: gpio
|
||||||
name: Basement Bathroom Door
|
name: Basement Bathroom Door
|
||||||
|
id: door
|
||||||
device_class: door
|
device_class: door
|
||||||
pin:
|
pin:
|
||||||
number: D7
|
number: D7
|
||||||
mode: INPUT_PULLUP
|
mode: INPUT_PULLUP
|
||||||
|
|
||||||
|
- platform: gpio
|
||||||
|
name: Basement Bathroom Motion
|
||||||
|
id: motion
|
||||||
|
device_class: motion
|
||||||
|
pin:
|
||||||
|
number: D0
|
||||||
|
mode: INPUT_PULLDOWN_16
|
||||||
|
|
||||||
|
- platform: template
|
||||||
|
id: motion_delay_30s
|
||||||
|
lambda: return id(motion).state;
|
||||||
|
filters:
|
||||||
|
- delayed_off: 30s
|
||||||
|
|
||||||
|
- platform: template
|
||||||
|
id: motion_delay_20m
|
||||||
|
lambda: return id(motion).state;
|
||||||
|
filters:
|
||||||
|
- delayed_off: 20min
|
||||||
|
|
||||||
|
- platform: template
|
||||||
|
id: trigger_motion
|
||||||
|
lambda: |-
|
||||||
|
if (id(door).state) {
|
||||||
|
return id(motion_delay_30s).state;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return id(motion_delay_20m).state;
|
||||||
|
}
|
||||||
|
on_press:
|
||||||
|
then:
|
||||||
|
- if:
|
||||||
|
condition:
|
||||||
|
and:
|
||||||
|
- binary_sensor.is_off: light
|
||||||
|
- binary_sensor.is_off: shower_light
|
||||||
|
- binary_sensor.is_off: heat
|
||||||
|
then:
|
||||||
|
- if:
|
||||||
|
condition:
|
||||||
|
binary_sensor.is_on: day_night
|
||||||
|
then:
|
||||||
|
- homeassistant.service:
|
||||||
|
service: homeassistant.turn_on
|
||||||
|
data:
|
||||||
|
entity_id: switch.basement_bathroom_light
|
||||||
|
else:
|
||||||
|
- homeassistant.service:
|
||||||
|
service: homeassistant.turn_on
|
||||||
|
data:
|
||||||
|
entity_id: switch.basement_shower_light
|
||||||
|
on_release:
|
||||||
|
then:
|
||||||
|
- homeassistant.service:
|
||||||
|
service: homeassistant.turn_off
|
||||||
|
data:
|
||||||
|
entity_id: switch.basement_bathroom_light, switch.basement_shower_light, switch.basement_bathroom_heat
|
||||||
|
- if:
|
||||||
|
condition:
|
||||||
|
binary_sensor.is_off: trigger_humidity
|
||||||
|
then:
|
||||||
|
- homeassistant.service:
|
||||||
|
service: homeassistant.turn_off
|
||||||
|
data:
|
||||||
|
entity_id: switch.basement_bathroom_fan
|
||||||
|
|
||||||
|
- platform: template
|
||||||
|
id: trigger_humidity
|
||||||
|
lambda: return (id(humidity).state - id(median_humidity).state) > 5;
|
||||||
|
filters:
|
||||||
|
- delayed_off: 5min
|
||||||
|
on_press:
|
||||||
|
then:
|
||||||
|
- homeassistant.service:
|
||||||
|
service: homeassistant.turn_on
|
||||||
|
data:
|
||||||
|
entity_id: switch.basement_bathroom_fan
|
||||||
|
on_release:
|
||||||
|
then:
|
||||||
|
- if:
|
||||||
|
condition:
|
||||||
|
binary_sensor.is_off: trigger_motion
|
||||||
|
then:
|
||||||
|
- homeassistant.service:
|
||||||
|
service: homeassistant.turn_off
|
||||||
|
data:
|
||||||
|
entity_id: switch.basement_bathroom_fan
|
||||||
|
|
||||||
- platform: homeassistant
|
- platform: homeassistant
|
||||||
id: day_night
|
id: day_night
|
||||||
entity_id: input_boolean.day_night
|
entity_id: input_boolean.day_night
|
||||||
|
|
||||||
|
- platform: homeassistant
|
||||||
|
id: light
|
||||||
|
entity_id: switch.basement_bathroom_light
|
||||||
|
|
||||||
- platform: homeassistant
|
- platform: homeassistant
|
||||||
id: shower_light
|
id: shower_light
|
||||||
entity_id: switch.basement_shower_light
|
entity_id: switch.basement_shower_light
|
||||||
|
|
||||||
|
- platform: homeassistant
|
||||||
|
id: heat
|
||||||
|
entity_id: switch.basement_bathroom_heat
|
||||||
|
|
||||||
output:
|
output:
|
||||||
- platform: gpio
|
- platform: gpio
|
||||||
pin: D3
|
pin: D3
|
||||||
@ -74,6 +168,7 @@ sensor:
|
|||||||
update_interval: 15s
|
update_interval: 15s
|
||||||
- platform: template
|
- platform: template
|
||||||
name: "Basement Bathroom Median Humidity"
|
name: "Basement Bathroom Median Humidity"
|
||||||
|
id: median_humidity
|
||||||
unit_of_measurement: '%'
|
unit_of_measurement: '%'
|
||||||
icon: mdi:water-percent
|
icon: mdi:water-percent
|
||||||
lambda: return id(humidity).state;
|
lambda: return id(humidity).state;
|
||||||
|
@ -25,7 +25,7 @@ binary_sensor:
|
|||||||
then:
|
then:
|
||||||
- switch.toggle: light
|
- switch.toggle: light
|
||||||
- platform: gpio
|
- platform: gpio
|
||||||
id: fan_button
|
id: heater_button
|
||||||
pin:
|
pin:
|
||||||
number: 3
|
number: 3
|
||||||
mode: INPUT_PULLUP
|
mode: INPUT_PULLUP
|
||||||
@ -49,13 +49,11 @@ switch:
|
|||||||
name: "Basement Shower Light"
|
name: "Basement Shower Light"
|
||||||
icon: mdi:lightbulb
|
icon: mdi:lightbulb
|
||||||
pin: 13
|
pin: 13
|
||||||
inverted: false
|
|
||||||
- platform: gpio
|
- platform: gpio
|
||||||
id: heater
|
id: heater
|
||||||
name: "Basement Bathroom Heater"
|
name: "Basement Bathroom Heater"
|
||||||
icon: mdi:radiator
|
icon: mdi:radiator
|
||||||
pin: 4
|
pin: 4
|
||||||
inverted: false
|
|
||||||
|
|
||||||
text_sensor:
|
text_sensor:
|
||||||
- !include common/text_sensor/version.yaml
|
- !include common/text_sensor/version.yaml
|
||||||
|
Loading…
Reference in New Issue
Block a user