|
@@ -650,15 +650,15 @@ async def rebindLostDevices():
|
|
|
async def userStateChangeCallback(user, state, prevState = None):
|
|
async def userStateChangeCallback(user, state, prevState = None):
|
|
|
reply = None
|
|
reply = None
|
|
|
if ('HTTP_CLIENT' in app.config) and (user in app.cache['devicemap']):
|
|
if ('HTTP_CLIENT' in app.config) and (user in app.cache['devicemap']):
|
|
|
- url = await db.fetch_one(query='SELECT url FROM callback_urls WHERE device = :device',
|
|
|
|
|
|
|
+ row = await db.fetch_one(query='SELECT url FROM callback_urls WHERE device = :device',
|
|
|
values={'device': app.cache['devicemap'][user]})
|
|
values={'device': app.cache['devicemap'][user]})
|
|
|
- app.logger.warning(pformat(url))
|
|
|
|
|
- reply = await app.config['HTTP_CLIENT'].post(url,
|
|
|
|
|
- json={'user': user,
|
|
|
|
|
- 'state': state,
|
|
|
|
|
- 'prev_state':prevState})
|
|
|
|
|
|
|
+ if row is not None:
|
|
|
|
|
+ reply = await app.config['HTTP_CLIENT'].post(row['url'],
|
|
|
|
|
+ json={'user': user,
|
|
|
|
|
+ 'state': state,
|
|
|
|
|
+ 'prev_state':prevState})
|
|
|
|
|
|
|
|
- app.logger.warning('{} changed state to: {}'.format(user, state))
|
|
|
|
|
|
|
+ app.logger.warning('{} changed state to: {}'.format(user, state))
|
|
|
return reply
|
|
return reply
|
|
|
|
|
|
|
|
def getUserStateCombined(user):
|
|
def getUserStateCombined(user):
|