Closed cgc007 closed 4 years ago
Hmm looks like it failed parsing the JSON response. The underlying library definitely needs better error handling. I'll keep this issue open until we get some better error handling in there that can explain what happened better. I'm guessing it couldn't reach the Bond hub at the time, or it got a garbage response.
I have a fireplace and I'm seeing this too with the 0.0.6 release
Sun Dec 15 2019 17:21:21 GMT-0600 (CST)
Update for light.fireplace_light fails
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 281, in async_update_ha_state
await self.async_device_update()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 461, in async_device_update
await self.hass.async_add_executor_job(self.update)
File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/config/custom_components/bond/light.py", line 77, in update
self._state = True if bondState['light'] == 1 else False
KeyError: 'light'
I can shed some light on this... The Bond hub is a "generic" IR/RF hub that can memorize IR/RF codes from any "device". While it's primarily used to enable Fans (and their associated lights), I started getting this once I added a generic device to my Bond hub. I happened to buy a set of fake "votive candles" and they came with a remote to turn them on and off. I installed that remote in my Bond hub as a "Device" rather than a fan or a light and then started getting these errors.
By default, the Bond bridge provides 4 different "Devices":
I'm guessing the current HA component is really only looking for Ceiling Fans, as I installed my votives as a "Device" and ended up with a fan.votives device in HA.
I think we need to expand the underlying library to properly identify the device class...
Dug a little deeper and pulled a local copy of the bond-home library and played with it. Here is my "votives" device information that is returned from the library:
{"name":"Votives","type":"GX","location":"Living Room","actions":["TurnOn","TurnOff","Stop","TogglePower"],"":"a3f5037e","commands":{"":"c667e693"},"state":{"":"32c34dad"},"properties":{"":"a3949c25"}}
The four types of devices are:
Without digging a lot deeper into the code, it would appear that you'll need a generic "device handler" which will actually call the bond.getDeviceIDs() (rather than it being in the light.py and fan.py). Following that code, you'll then have to parse the "type" from each device that is iterated from the above call and matched to one of the above entity types, prior to calling the add_entities, because you won't know what entity type to add until you've seen the device type.
"CF" should map to entity "fan" "FP" should map to entity "light", as it supports flame higher, flame lower, on, off (like a dimmer) "MS" should map to entity "cover" and I'd probably just map "GX" to a "switch" as it only supports on, off, and power toggle.
Wish I could actually dive in and help on this, but I've never gotten a HA development environment going...
This issue is a bit old now, and there have been some significant updates since it was opened. Is it still a problem?
It should probably be closed and I'll reopen new issues with my current problems.
Not sure if this is an HA problem or a Bond integration problem but I figured you might like to know. Please let me know if I can shed more light on the issue.