updating configuration
This commit is contained in:
@@ -30,9 +30,12 @@ class ToiletPresence(hass.Hass):
|
|||||||
self.listen_state(self.distance_changed, self.args['sensor'])
|
self.listen_state(self.distance_changed, self.args['sensor'])
|
||||||
|
|
||||||
def distance_changed(self, entity, attribute, old, new, kwargs):
|
def distance_changed(self, entity, attribute, old, new, kwargs):
|
||||||
distance = int(new)
|
if new == 'unknown':
|
||||||
|
return
|
||||||
|
|
||||||
|
distance = float(new)
|
||||||
state = ""
|
state = ""
|
||||||
if (distance > 1100 or distance < 750):
|
if (distance > 1.100 or distance < 0.750):
|
||||||
self.timers_off()
|
self.timers_off()
|
||||||
self.timers.append(self.run_in(self.run_in_presense_off, self.presence_timeout))
|
self.timers.append(self.run_in(self.run_in_presense_off, self.presence_timeout))
|
||||||
self.log('re-setting timer for {}s.'.format(self.presence_timeout))
|
self.log('re-setting timer for {}s.'.format(self.presence_timeout))
|
||||||
|
|||||||
@@ -0,0 +1,51 @@
|
|||||||
|
esphome:
|
||||||
|
name: bath_light
|
||||||
|
platform: ESP8266
|
||||||
|
board: esp01_1m
|
||||||
|
|
||||||
|
wifi:
|
||||||
|
ssid: !secret wifi_24_name
|
||||||
|
password: !secret wifi_24_pass
|
||||||
|
|
||||||
|
# Enable fallback hotspot (captive portal) in case wifi connection fails
|
||||||
|
ap:
|
||||||
|
ssid: "BathLight Fallback Hotspot"
|
||||||
|
password: !secret esphome_captive_pass
|
||||||
|
|
||||||
|
logger:
|
||||||
|
|
||||||
|
api:
|
||||||
|
password: !secret esphome_pass
|
||||||
|
|
||||||
|
ota:
|
||||||
|
password: !secret esphome_pass
|
||||||
|
|
||||||
|
binary_sensor:
|
||||||
|
- platform: gpio
|
||||||
|
pin:
|
||||||
|
number: GPIO14
|
||||||
|
mode: INPUT_PULLUP
|
||||||
|
inverted: True
|
||||||
|
id: button_1
|
||||||
|
on_press:
|
||||||
|
then:
|
||||||
|
- light.toggle: light_1
|
||||||
|
|
||||||
|
- platform: status
|
||||||
|
name: "Bath status"
|
||||||
|
|
||||||
|
output:
|
||||||
|
- platform: gpio
|
||||||
|
pin: GPIO12
|
||||||
|
id: relay_1
|
||||||
|
|
||||||
|
light:
|
||||||
|
- platform: binary
|
||||||
|
name: "bath"
|
||||||
|
id: light_1
|
||||||
|
output: relay_1
|
||||||
|
|
||||||
|
status_led:
|
||||||
|
pin:
|
||||||
|
number: GPIO13
|
||||||
|
inverted: yes
|
||||||
@@ -30,11 +30,11 @@ globals:
|
|||||||
type: bool
|
type: bool
|
||||||
restore_value: yes
|
restore_value: yes
|
||||||
initial_value: 'true'
|
initial_value: 'true'
|
||||||
- id: cold_value
|
- id: counter_cold_value
|
||||||
type: float
|
type: float
|
||||||
restore_value: yes
|
restore_value: yes
|
||||||
initial_value: '210.29'
|
initial_value: '210.29'
|
||||||
- id: hot_value
|
- id: counter_hot_value
|
||||||
type: float
|
type: float
|
||||||
restore_value: yes
|
restore_value: yes
|
||||||
initial_value: '109.74'
|
initial_value: '109.74'
|
||||||
@@ -49,7 +49,7 @@ binary_sensor:
|
|||||||
- delayed_off: 100ms
|
- delayed_off: 100ms
|
||||||
on_press:
|
on_press:
|
||||||
then:
|
then:
|
||||||
- lambda: 'id(cold_value) += 0.01;'
|
- lambda: 'id(counter_cold_value) += 0.01;'
|
||||||
|
|
||||||
- platform: gpio
|
- platform: gpio
|
||||||
name: pulse_hot
|
name: pulse_hot
|
||||||
@@ -60,22 +60,22 @@ binary_sensor:
|
|||||||
- delayed_off: 100ms
|
- delayed_off: 100ms
|
||||||
on_press:
|
on_press:
|
||||||
then:
|
then:
|
||||||
- lambda: 'id(hot_value) += 0.01;'
|
- lambda: 'id(counter_hot_value) += 0.01;'
|
||||||
|
|
||||||
sensor:
|
sensor:
|
||||||
- platform: uptime
|
- platform: uptime
|
||||||
name: "Watercontrol Uptime"
|
name: "Watercontrol Uptime"
|
||||||
|
|
||||||
- platform: template
|
- platform: template
|
||||||
name: "counter hot"
|
name: "counter_hot"
|
||||||
lambda: |-
|
lambda: |-
|
||||||
return id(hot_value);
|
return id(counter_hot_value);
|
||||||
update_interval: 60s
|
update_interval: 60s
|
||||||
|
|
||||||
- platform: template
|
- platform: template
|
||||||
name: "counter cold"
|
name: "counter_cold"
|
||||||
lambda: |-
|
lambda: |-
|
||||||
return id(cold_value);
|
return id(counter_cold_value);
|
||||||
update_interval: 60s
|
update_interval: 60s
|
||||||
|
|
||||||
- platform: ultrasonic
|
- platform: ultrasonic
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
- platform: mqtt
|
# - platform: mqtt
|
||||||
state_topic: 'home/bath/bath/distance'
|
# state_topic: 'home/bath/bath/distance'
|
||||||
name: 'toilet_distance'
|
# name: 'toilet_distance'
|
||||||
unit_of_measurement: 'cm'
|
# unit_of_measurement: 'cm'
|
||||||
@@ -1,9 +1,3 @@
|
|||||||
- platform: mqtt
|
|
||||||
state_topic: 'home/domofon/$uptime'
|
|
||||||
name: 'uptime_domofon'
|
|
||||||
- platform: mqtt
|
|
||||||
state_topic: 'home/bath/$uptime'
|
|
||||||
name: 'uptime_bath'
|
|
||||||
- platform: mqtt
|
- platform: mqtt
|
||||||
state_topic: 'home/kitchen-led/$uptime'
|
state_topic: 'home/kitchen-led/$uptime'
|
||||||
name: 'uptime_kitchen-led'
|
name: 'uptime_kitchen-led'
|
||||||
|
|||||||
@@ -371,7 +371,7 @@ views:
|
|||||||
show_header_toggle: false
|
show_header_toggle: false
|
||||||
entities:
|
entities:
|
||||||
- sensor.airfresher_uptime
|
- sensor.airfresher_uptime
|
||||||
- sensor.uptime_bath
|
- sensor.watercontrol_uptime
|
||||||
- sensor.domofon_uptime
|
- sensor.domofon_uptime
|
||||||
- sensor.uptime_kitchen_led
|
- sensor.uptime_kitchen_led
|
||||||
- sensor.uptime_nest
|
- sensor.uptime_nest
|
||||||
|
|||||||
Reference in New Issue
Block a user