sleep tweak
This commit is contained in:
@@ -77,7 +77,6 @@ class SleepSetter(Hass, Mqtt):
|
|||||||
def handle_button(self, event_name, data, kwargs):
|
def handle_button(self, event_name, data, kwargs):
|
||||||
topic = data['topic']
|
topic = data['topic']
|
||||||
# self.log(f'Button event for: {topic}')
|
# self.log(f'Button event for: {topic}')
|
||||||
if (elev := self.sun_elevation) < 0:
|
|
||||||
try:
|
try:
|
||||||
payload = json.loads(data['payload'])
|
payload = json.loads(data['payload'])
|
||||||
action = payload['action']
|
action = payload['action']
|
||||||
@@ -88,9 +87,6 @@ class SleepSetter(Hass, Mqtt):
|
|||||||
else:
|
else:
|
||||||
self.handle_action(action)
|
self.handle_action(action)
|
||||||
|
|
||||||
else:
|
|
||||||
self.log(f'Ignoring event because sun elevation {elev} > 0')
|
|
||||||
|
|
||||||
def handle_action(self, action: str):
|
def handle_action(self, action: str):
|
||||||
if action == '':
|
if action == '':
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -1,13 +1,14 @@
|
|||||||
sleep:
|
sleep:
|
||||||
module: sleep
|
module: sleep
|
||||||
class: SleepSetter
|
class: SleepSetter
|
||||||
elevation_limit: -10
|
# elevation_limit: -10
|
||||||
scene: scene.in_bed
|
scene: scene.in_bed
|
||||||
variable: input_boolean.sleeping
|
variable: input_boolean.sleeping
|
||||||
button:
|
button:
|
||||||
- Bedroom Button 1
|
- Bedroom Button 1
|
||||||
- Bedroom Button 2
|
- Bedroom Button 2
|
||||||
- Living Room Button
|
- Living Room Button
|
||||||
|
- Bathroom Button
|
||||||
off_apps:
|
off_apps:
|
||||||
- bedroom
|
- bedroom
|
||||||
- living_room
|
- living_room
|
||||||
|
|||||||
Reference in New Issue
Block a user