sebr / bhyve-home-assistant

Orbit BHyve custom component for Home Assistant
MIT License
252 stars 42 forks source link

KeyError: 'percent' #189

Closed zSprawl closed 1 year ago

zSprawl commented 1 year ago

Describe the bug Upon start or restart of the Bhyve integration, it throws an error. The integration loads, and I can control each of the 4 hoses/valves, but it does not display any of the sensors for battery, state, or four zones. These sensors remain Unavailable despite being able to control the device manually.

I have tried rebooting multiple times and have replaced the battery. The battery shows at 100% now in the BHyve app.

Expected behaviour Each of the sensors populate with battery information, current state of the device, and the last time each zone was watered.

BHyve devices I'm using an HT34-0001 with firmware 58 (the latest). It's a 4-hose watering device.

Device Diagnostics Logger: homeassistant.components.sensor Source: custom_components/bhyve/sensor.py:92 Integration: Sensor (documentation, issues) First occurred: 9:31:39 AM (4 occurrences) Last logged: 10:05:10 AM Error while setting up bhyve platform for sensor

Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 304, in _async_setup_platform await asyncio.shield(task) File "/config/custom_components/bhyve/sensor.py", line 58, in async_setup_entry sensors.append(BHyveBatterySensor(hass, bhyve, device)) File "/config/custom_components/bhyve/sensor.py", line 73, in init super().init( File "/config/custom_components/bhyve/init.py", line 268, in init self._setup(device) File "/config/custom_components/bhyve/sensor.py", line 92, in _setup self._state = battery["percent"] KeyError: 'percent'

disforw commented 1 year ago

I fixed in PR #181, awaiting approval….