Made requests parsing more robust against messages with target not set (e.g. messages received over HTTP API)

This commit is contained in:
Fabio Manganiello 2018-12-18 14:59:10 +01:00
parent 13463420d9
commit 8fe4d77e3d

View file

@ -49,7 +49,7 @@ class Request(Message):
def build(cls, msg):
msg = super().parse(msg)
args = {
'target' : msg['target'],
'target' : msg.get('target', Config.get('device_id')),
'action' : msg['action'],
'args' : msg['args'] if 'args' in msg else {},
}