studioimaginaire / phue

A Python library for the Philips Hue system
Other
1.53k stars 267 forks source link

KeyError: 'lastupdated' with 'set_sensor_state' of an IP sensor #101

Closed bennert closed 7 years ago

bennert commented 7 years ago

Reproduction scenario: bridgeDestination.set_sensor_state(5, 'presence', bridgeSource.get_sensor(6, 'state')['presence'])

Traceback: File "hueMotion.py", line 27, in bridgeDestination.set_sensor_state(5, 'presence', bridgeSource.get_sensor(6, 'state')['presence']) File "build/bdist.linux-armv7l/egg/phue.py", line 991, in set_sensor_state File "build/bdist.linux-armv7l/egg/phue.py", line 1015, in set_sensor_content KeyError: 'lastupdated'

Source code: del data["lastupdated"]

should be replace by: if "lastupdated" in data: del data["lastupdated"]

natcl commented 7 years ago

Can you send a pull-request ?

bennert commented 7 years ago

I'm new with committing to gitbub, but finally I created a pull-request: [https://github.com/studioimaginaire/phue/pull/102]

bennert commented 7 years ago

Verified pull request 102 => Result OK