DeviceTimeoutError
Seems that the library somehow gets into a weird state where it won't talk anymore to the light, and has to be restarted for it to work again.
Traceback (most recent call last):
File "/home/lifx/python/local/lib/python2.7/site-packages/apscheduler/executors/base.py", line 112, in run_job
retval = job.func(*job.args, **job.kwargs)
File "/home/lifx/python/local/lib/python2.7/site-packages/wrapt/wrappers.py", line 522, in __call__
args, kwargs)
File "/home/lifx/python/local/lib/python2.7/site-packages/logtool/log_wrap.py", line 104, in __call__
rc = fn (*args, **kwargs)
File "./lifx_schedule", line 56, in set_white_color
for l in lights.by_label('Main'):
File "/home/lifx/python/local/lib/python2.7/site-packages/lifx/client.py", line 221, in by_label
return filter(lambda d: d.label == label, self.get_devices())
File "/home/lifx/python/local/lib/python2.7/site-packages/lifx/client.py", line 221, in <lambda>
return filter(lambda d: d.label == label, self.get_devices())
File "/home/lifx/python/local/lib/python2.7/site-packages/lifx/device.py", line 260, in label
response = self._block_for_response(pkt_type=protocol.TYPE_GETLABEL)
File "/home/lifx/python/local/lib/python2.7/site-packages/lifx/device.py", line 88, in _block_for_response
return self._block_for(False, True, *args, **kwargs)
File "/home/lifx/python/local/lib/python2.7/site-packages/lifx/device.py", line 136, in _block_for
raise DeviceTimeoutError(self, timeout, DEFAULT_RETRANSMITS)
DeviceTimeoutError: Device with id:'d073d502abc8' timed out after 2.0 seconds and 10 retransmissions.
I believe the light in question is online and fully operational. Yes I know, the stack trace would imply otherwise.
Thinking about this, by_label() should never return DeviceTimeoutError as we are only trying to get a list of lights, not try to talk to them.
Still seems to be a problem in that if DeviceTimeoutError occurs in some situations it will forget about that light even if it is turned back on again. Still investigating.
Think we really should cache the label so we don't have to do a network access every time __repr__ is called on the light.
I too have run into this. The code should really keep going instead of crashing like this. I shouldn't have to restart the script because of a momentary IP glitch.