Issues with new version (1.0.0)
gregoryduckworth opened this issue · 10 comments
Describe the bug
When installing the latest version (1.0.0) it seems to have problems connecting. It was working fine on 0.6.0.
To Reproduce
Steps to reproduce the behaviour:
- Install v1.0.0 and configure with your credentials
Expected behaviour
Able to connect and provide sensor data
Version
What version of the integration and what version of Home Assistant are you running?
1.0.0
Debug log
Error 1:
Error while setting up hildebrandglow_dcc platform for sensor
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 225, in _async_refresh
self.data = await self._async_update_data()
File "/config/custom_components/hildebrandglow_dcc/sensor.py", line 370, in _async_update_data
return await tariff_data(self)
File "/config/custom_components/hildebrandglow_dcc/sensor.py", line 229, in tariff_data
return tariff
UnboundLocalError: local variable 'tariff' referenced before assignment
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 281, in _async_setup_platform
await asyncio.shield(task)
File "/config/custom_components/hildebrandglow_dcc/sensor.py", line 85, in async_setup_entry
await coordinator.async_config_entry_first_refresh()
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 197, in async_config_entry_first_refresh
raise ex
homeassistant.exceptions.ConfigEntryNotReady: local variable 'tariff' referenced before assignment
Error 2:
Unexpected error fetching tariff data: local variable 'tariff' referenced before assignment
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 225, in _async_refresh
self.data = await self._async_update_data()
File "/config/custom_components/hildebrandglow_dcc/sensor.py", line 370, in _async_update_data
return await tariff_data(self)
File "/config/custom_components/hildebrandglow_dcc/sensor.py", line 229, in tariff_data
return tariff
UnboundLocalError: local variable 'tariff' referenced before assignment
Error 3:
Unexpected exception: local variable 't' referenced before assignment
Traceback (most recent call last):
File "/config/custom_components/hildebrandglow_dcc/sensor.py", line 202, in tariff_data
tariff = await self.hass.async_add_executor_job(self.resource.get_tariff)
File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/local/lib/python3.10/site-packages/glowmarkt/glowmarkt.py", line 56, in get_tariff
return self.client.get_tariff(self.id)
File "/usr/local/lib/python3.10/site-packages/glowmarkt/glowmarkt.py", line 408, in get_tariff
return t
UnboundLocalError: local variable 't' referenced before assignment
Do you have tariff data available in the Bright app @gregoryduckworth?
If not, you should disable the rate and standing sensors to avoid unnecessarily polling the API for data that isn't there
If you do, then something else is going wrong. Can you try enabling debug logging (as detailed here: https://github.com/HandyHat/ha-hildebrandglow-dcc#debugging) and hopefully that will produce more meaningful information?
I will look into making this error message more helpful :)
However I’m unable to disable it as the integration is coming back with no entities:
Hello, I have a similar problem with no devices/entities, here's my debug log
2023-01-02 12:38:40.725 DEBUG (MainThread) [custom_components.hildebrandglow_dcc] Successful Post to https://api.glowmarkt.com/api/v0-1/auth
2023-01-02 12:38:40.828 DEBUG (MainThread) [custom_components.hildebrandglow_dcc.sensor] Successful GET to https://api.glowmarkt.com/api/v0-1/virtualentity
2023-01-02 12:38:40.912 DEBUG (MainThread) [custom_components.hildebrandglow_dcc.sensor] Successful GET to https://api.glowmarkt.com/api/v0-1/virtualentity/c80267e8-576f-40f4-adae-dc183fd6d70e/resources
2023-01-02 12:38:41.201 ERROR (MainThread) [custom_components.hildebrandglow_dcc.sensor] Unexpected exception: local variable 't' referenced before assignment
Traceback (most recent call last):
File "/config/custom_components/hildebrandglow_dcc/sensor.py", line 202, in tariff_data
tariff = await self.hass.async_add_executor_job(self.resource.get_tariff)
File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/local/lib/python3.10/site-packages/glowmarkt/glowmarkt.py", line 56, in get_tariff
return self.client.get_tariff(self.id)
File "/usr/local/lib/python3.10/site-packages/glowmarkt/glowmarkt.py", line 408, in get_tariff
return t
UnboundLocalError: local variable 't' referenced before assignment
2023-01-02 12:38:41.209 DEBUG (MainThread) [custom_components.hildebrandglow_dcc.sensor] Successful GET to https://api.glowmarkt.com/api/v0-1/resource/6d1202db-98d4-46fb-b8b8-3ca1fc25bf74/tariff
2023-01-02 12:38:41.209 ERROR (MainThread) [custom_components.hildebrandglow_dcc.sensor] Unexpected error fetching tariff data: local variable 'tariff' referenced before assignment
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 225, in _async_refresh
self.data = await self._async_update_data()
File "/config/custom_components/hildebrandglow_dcc/sensor.py", line 370, in _async_update_data
return await tariff_data(self)
File "/config/custom_components/hildebrandglow_dcc/sensor.py", line 229, in tariff_data
return tariff
UnboundLocalError: local variable 'tariff' referenced before assignment
2023-01-02 12:38:41.210 DEBUG (MainThread) [custom_components.hildebrandglow_dcc.sensor] Finished fetching tariff data in 0.298 seconds (success: False)
2023-01-02 12:38:41.226 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up hildebrandglow_dcc platform for sensor
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 225, in _async_refresh
self.data = await self._async_update_data()
File "/config/custom_components/hildebrandglow_dcc/sensor.py", line 370, in _async_update_data
return await tariff_data(self)
File "/config/custom_components/hildebrandglow_dcc/sensor.py", line 229, in tariff_data
return tariff
UnboundLocalError: local variable 'tariff' referenced before assignment
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 281, in _async_setup_platform
await asyncio.shield(task)
File "/config/custom_components/hildebrandglow_dcc/sensor.py", line 85, in async_setup_entry
await coordinator.async_config_entry_first_refresh()
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 197, in async_config_entry_first_refresh
raise ex
homeassistant.exceptions.ConfigEntryNotReady: local variable 'tariff' referenced before assignment
hi, just to say i have the exact same issue (that is, no devices or entities show up) after updating to 1.0.0, i've rolled back to 0.6.0 for now.
Hey all, this should hopefully be fixed in v1.0.1. Please try it out and let me know!
Thanks for you swift response but unfortunately I still don't have devices/entities with v1.0.1
2023-01-02 14:40:29.216 DEBUG (MainThread) [custom_components.hildebrandglow_dcc] Successful Post to https://api.glowmarkt.com/api/v0-1/auth
2023-01-02 14:40:29.548 DEBUG (MainThread) [custom_components.hildebrandglow_dcc.sensor] Successful GET to https://api.glowmarkt.com/api/v0-1/virtualentity
2023-01-02 14:40:29.907 DEBUG (MainThread) [custom_components.hildebrandglow_dcc.sensor] Successful GET to https://api.glowmarkt.com/api/v0-1/virtualentity/c80267e8-576f-40f4-adae-dc183fd6d70e/resources
2023-01-02 14:40:30.446 ERROR (MainThread) [custom_components.hildebrandglow_dcc.sensor] Unexpected exception: local variable 't' referenced before assignment. Please open an issue.
Traceback (most recent call last):
File "/config/custom_components/hildebrandglow_dcc/sensor.py", line 214, in tariff_data
tariff = await self.hass.async_add_executor_job(self.resource.get_tariff)
File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/local/lib/python3.10/site-packages/glowmarkt/glowmarkt.py", line 56, in get_tariff
return self.client.get_tariff(self.id)
File "/usr/local/lib/python3.10/site-packages/glowmarkt/glowmarkt.py", line 408, in get_tariff
return t
UnboundLocalError: local variable 't' referenced before assignment
2023-01-02 14:40:30.451 DEBUG (MainThread) [custom_components.hildebrandglow_dcc.sensor] Successful GET to https://api.glowmarkt.com/api/v0-1/resource/6d1202db-98d4-46fb-b8b8-3ca1fc25bf74/tariff
2023-01-02 14:40:30.451 ERROR (MainThread) [custom_components.hildebrandglow_dcc.sensor] Unexpected error fetching tariff data: local variable 'tariff' referenced before assignment
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 225, in _async_refresh
self.data = await self._async_update_data()
File "/config/custom_components/hildebrandglow_dcc/sensor.py", line 394, in _async_update_data
return await tariff_data(self)
File "/config/custom_components/hildebrandglow_dcc/sensor.py", line 243, in tariff_data
if tariff:
UnboundLocalError: local variable 'tariff' referenced before assignment
2023-01-02 14:40:30.455 DEBUG (MainThread) [custom_components.hildebrandglow_dcc.sensor] Finished fetching tariff data in 0.548 seconds (success: False)
2023-01-02 14:40:30.476 WARNING (Thread-2) [websocket] websocket connected
2023-01-02 14:40:30.505 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up hildebrandglow_dcc platform for sensor
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 225, in _async_refresh
self.data = await self._async_update_data()
File "/config/custom_components/hildebrandglow_dcc/sensor.py", line 394, in _async_update_data
return await tariff_data(self)
File "/config/custom_components/hildebrandglow_dcc/sensor.py", line 243, in tariff_data
if tariff:
UnboundLocalError: local variable 'tariff' referenced before assignment
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 281, in _async_setup_platform
await asyncio.shield(task)
File "/config/custom_components/hildebrandglow_dcc/sensor.py", line 85, in async_setup_entry
await coordinator.async_config_entry_first_refresh()
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 197, in async_config_entry_first_refresh
raise ex
homeassistant.exceptions.ConfigEntryNotReady: local variable 'tariff' referenced before assignment
Ah, it looks like this is actually an issue with the upstream library. I will try to work around it
Hey all, please try v1.0.2 which should actually fix this :)
Thought I'd come back and say it all looks good and the improved messaging around tariffs is also a great addition.