IndigoDomotics / alexa-hue-bridge

An Indigo plugin that exposes devices as Hue lights for Amazon Alexa devices (Echo, Fire TV)
The Unlicense
22 stars 2 forks source link

getHueDeviceJSON exception #18

Closed davidnewhall closed 3 years ago

davidnewhall commented 5 years ago

I just replaced my Kitchen Light Switch, physically, and in the Alexa bridge configuration. I then discovered devices and turned it on/off, both commands worked, but an error was emitted to the log. I don't really have any particular issue here since everything seems fine, but as a fellow developer I like to know about exceptions in my code. This is data for you. Let me know if you need any more info from my setup.

I suspect this has something to do with flat-out replacing "Kitchen Light" in the configuration and Alexa did say "no new devices" - she was still able to control the new switch.

Indigo 7.3.1 Alexa Hue Bridge 3.0.29

May 29, 2019 at 11:45:17 PM
   Alexa-Hue Bridge                Request received from 192.168.1.9:41270: Setting on state of Alexa device "Kitchen Light" ["Kitchen Light"] to ON
   Z-Wave                          sent "Kitchen Light" on
   Alexa-Hue Bridge                Request received from 192.168.1.9:41272: Setting on state of Alexa device "Kitchen Light" ["Kitchen Light"] to OFF
   Z-Wave                          sent "Kitchen Light" off
   Alexa-Hue Bridge Error          getHueDeviceJSON exception: 
Traceback (most recent call last):
  File "/Library/Application Support/Perceptive Automation/Indigo 7.3/Plugins/Alexa-Hue Bridge.indigoPlugin/Contents/Server Plugin/hue_listener.py", line 331, in getHueDeviceJSON
    self.alexaDeviceNameKey = PLUGIN.globals['alexaHueBridge'][p1_ahbDevId]['hashKeys'][p3_alexaDeviceHashedKey]
KeyError: '272f2e6698a2438150248b97d40a6b96b5effb9868be520bfb1eb7474f2732a3'

   Alexa-Hue Bridge Error          StandardError detected in HttpdRequestHandler for 'self.ahbDev.name'. Line '185' has error='must be string or buffer, not None'
   Alexa-Hue Bridge Error          StandardError detected in HttpdRequestHandler for 'Alexa2'. Line '185' has error='must be string or buffer, not None'
autolog commented 5 years ago

Thanks for the report. :)

I think it is because Alexa still has the same name for the old device as new device. The plugin has generated a new hashKey for the new device but Alexa still has the hashKey for the old device. If you go into the Alexa web interface and delete the Kitchen Light switch device and then do a re-discovery it should (hopefully) get rid of the error.

The plugin should be able to handle this error - I will take a look at it. :)

davidnewhall commented 5 years ago

Ah, I'll give that a shot. Thanks!