sebr / bhyve-home-assistant

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

Fix sensor initialization #256

Closed sammessina closed 2 weeks ago

sammessina commented 1 month ago

This fixes the usage of an undefined variable. I was getting this error:

ERROR (MainThread) [homeassistant.components.sensor] Error while setting up bhyve platform for sensor
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 364, in _async_setup_platform
    await asyncio.shield(awaitable)
  File "/config/custom_components/bhyve/sensor.py", line 60, in async_setup_entry
    if zone_name is None:
       ^^^^^^^^^
UnboundLocalError: cannot access local variable 'zone_name' where it is not associated with a value