silencing warnings
This commit is contained in:
@@ -1,7 +1,5 @@
|
||||
import asyncio
|
||||
import json
|
||||
|
||||
from appdaemon.adapi import ADAPI
|
||||
from appdaemon.adbase import ADBase
|
||||
from appdaemon.plugins.hass.hassapi import Hass
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ class Leaving(Hass):
|
||||
self.listen_state(self.turn_everything_off, entity_id=self.args['person'], old='home')
|
||||
|
||||
def turn_everything_off(self, entity, attribute, old, new, **kwargs):
|
||||
self.log(f'turning everything off')
|
||||
self.log('turning everything off')
|
||||
self.log(kwargs)
|
||||
for app_name in self.args['apps']:
|
||||
try:
|
||||
|
||||
@@ -71,21 +71,21 @@ class SleepSetter(Hass, Mqtt):
|
||||
self.all_off()
|
||||
try:
|
||||
self.call_service('scene/turn_on', entity_id=self.scene)
|
||||
except:
|
||||
except Exception:
|
||||
return
|
||||
else:
|
||||
self.log(f'Turned on scene: {self.scene}')
|
||||
# self.turn_on(self.scene)
|
||||
|
||||
def handle_button(self, event_name, data, **kwargs):
|
||||
topic = data['topic']
|
||||
# topic = data['topic']
|
||||
# self.log(f'Button event for: {topic}')
|
||||
try:
|
||||
payload = json.loads(data['payload'])
|
||||
action = payload['action']
|
||||
except json.JSONDecodeError:
|
||||
self.log(f'Error decoding JSON from {data["payload"]}', level='ERROR')
|
||||
except KeyError as e:
|
||||
except KeyError:
|
||||
return
|
||||
else:
|
||||
self.handle_action(action)
|
||||
@@ -103,19 +103,19 @@ class SleepSetter(Hass, Mqtt):
|
||||
self.on_apps()
|
||||
|
||||
def all_off(self):
|
||||
self.log(f'Deactivating apps')
|
||||
self.log('Deactivating apps')
|
||||
for app_name in self.args['off_apps']:
|
||||
try:
|
||||
self.get_app(app_name).deactivate(cause='sleep setter')
|
||||
except:
|
||||
except Exception:
|
||||
self.log(f'Failed to deactivate {app_name}')
|
||||
continue
|
||||
|
||||
self.log(f'Turning off entities')
|
||||
self.log('Turning off entities')
|
||||
for entity in self.args['off_entities']:
|
||||
try:
|
||||
self.turn_off(entity)
|
||||
except:
|
||||
except Exception:
|
||||
self.log(f'Failed to turn off {entity}')
|
||||
continue
|
||||
|
||||
@@ -124,7 +124,7 @@ class SleepSetter(Hass, Mqtt):
|
||||
for app_name in on_apps:
|
||||
try:
|
||||
self.get_app(app_name).activate(kwargs={'cause': 'sleep setter'})
|
||||
except:
|
||||
except Exception:
|
||||
return
|
||||
else:
|
||||
self.log(f'Activated {app_name}')
|
||||
|
||||
Reference in New Issue
Block a user