jimboca/harmonyhub-polyglot

Need to renew token on poll failure

Closed this issue · 2 comments

If the harmony hub token becomes invalid or out of date, then poll will fail.

Possible fix in commit: 9ba7090

The fix works, will show the following in the log that it gets a new token:

2017-03-19 20:47:32,006 ERROR    harmonyhub Hub:MasterBedroom:get_current_activity: Traceback (most recent call last):
  File "/home/pi/development/harmonyhub-polyglot/harmony_hub_nodes/HarmonyHub.py", line 128, in _get_current_activity
    ca = self.client.get_current_activity()
  File "/usr/local/lib/python2.7/dist-packages/pyharmony/client.py", line 82, in get_current_activity
    assert action_cmd.attrib['errorcode'] == '200'
AssertionError

2017-03-19 20:47:34,047 INFO     harmonyhub Hub:MasterBedroom:get_client: Initializing PyHarmony Client
2017-03-19 20:47:35,205 INFO     harmonyhub Hub:MasterBedroom:get_client: PyHarmony token= bbb9b1d9-2af2-432a-3b6d-717dec27ca2d
2017-03-19 20:47:35,329 INFO     harmonyhub Hub:MasterBedroom:get_client: PyHarmony client= <pyharmony.client.HarmonyClient object at 0x7490fb30>
2017-03-19 23:16:48,723 INFO     harmonyhub Hub:MasterBedroom:_set_current_activity: activity=-1, index=0