updating configuration

This commit is contained in:
Your Name
2019-12-03 21:21:18 +03:00
parent 7b74d8015f
commit 345c9e01d0
6 changed files with 69 additions and 21 deletions
@@ -30,9 +30,12 @@ class ToiletPresence(hass.Hass):
self.listen_state(self.distance_changed, self.args['sensor'])
def distance_changed(self, entity, attribute, old, new, kwargs):
distance = int(new)
if new == 'unknown':
return
distance = float(new)
state = ""
if (distance > 1100 or distance < 750):
if (distance > 1.100 or distance < 0.750):
self.timers_off()
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))