fix sensors path

This commit is contained in:
Malte 2023-11-20 00:51:55 +01:00
parent 18cdf3f565
commit 582d8382cc

View file

@ -97,8 +97,8 @@ class SpaceapiBot(Plugin):
try: try:
fmt = { fmt = {
'lastchange': datetime.fromtimestamp(state['state']['lastchange']).strftime('%H:%M'), 'lastchange': datetime.fromtimestamp(state['state']['lastchange']).strftime('%H:%M'),
'known_users': state.get('state', {}).get('sensors', {}).get('people_now_present', [{}])[0].get('names', ""), 'known_users': state.get('sensors', {}).get('people_now_present', [{}])[0].get('names', ""),
'user_cnt': state.get('state', {}).get('sensors', {}).get('people_now_present', [{}])[0].get('value', 0) 'user_cnt': state.get('sensors', {}).get('people_now_present', [{}])[0].get('value', 0)
} }
if state['state']['open']: if state['state']['open']:
body = self.config['messages']['open'].format(**fmt) body = self.config['messages']['open'].format(**fmt)