firstof9 / ha-openei

OpenEI integration for Home Assistant
MIT License
15 stars 2 forks source link

0.0.8 - Integration stuck at "Retrying setup: None" #17

Closed Tuxrug closed 3 years ago

Tuxrug commented 3 years ago

I am running Home Assistant 2021.9.4 in Docker with HACS 1.15.2.

I have 0.0.8 installed via HACS, but I also tried other versions back to 0.0.4, and tried selecting other providers, but I keep getting "Retrying setup: None" in the Integrations page of Home Assistant.

image

The only error that appears in the logs for custom_components.openei is this repeating a few times

2021-09-07 23:39:24 ERROR (MainThread) [custom_components.openei] Error fetching openei data:

I verified my API key is working by manually requesting a rateplan with it and it successfully returned a .json with rateplan information. Since the correct utility wasn't showing in the list, I tried manually editing my Home Assistant core.config_entries to replace the utility and rateplan ID and that did not change the error or log behavior. I have also tried removing the integration, uninstalling OpenEI from HACS, restarting Home Assistant's entire Docker container, re-installing OpenEI, and then restarting the Docker container again.

Here are the logs from Home Assistant for a few minutes after startup:

2021-09-07 23:39:16 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration variable which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant 2021-09-07 23:39:16 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration weatheralerts which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant 2021-09-07 23:39:16 WARNING (SyncWorker_3) [homeassistant.loader] We found a custom integration hacs which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant 2021-09-07 23:39:16 WARNING (SyncWorker_1) [homeassistant.loader] We found a custom integration car_wash which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant 2021-09-07 23:39:16 WARNING (SyncWorker_4) [homeassistant.loader] We found a custom integration openei which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant 2021-09-07 23:39:16 WARNING (SyncWorker_2) [homeassistant.loader] We found a custom integration monitor_docker which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant 2021-09-07 23:39:16 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration vivint which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant 2021-09-07 23:39:24 ERROR (MainThread) [custom_components.openei] Error fetching openei data: 2021-09-07 23:39:24 WARNING (MainThread) [homeassistant.config_entries] Config entry 'Black Hills Power Inc' for openei integration not ready yet: None; Retrying in background 2021-09-07 23:39:33 WARNING (MainThread) [homeassistant.setup] Setup of zone is taking over 10 seconds. 2021-09-07 23:39:33 ERROR (MainThread) [hole] Can not load data from hole: pihole.tuxrug.net:80 2021-09-07 23:39:33 WARNING (MainThread) [homeassistant.components.pi_hole] Failed to connect: Can not load data from hole: pihole.tuxrug.net:80 2021-09-07 23:39:33 WARNING (MainThread) [homeassistant.config_entries] Config entry 'Pi-Hole' for pi_hole integration not ready yet: Can not load data from *hole: pihole.tuxrug.net:80; Retrying in background 2021-09-07 23:39:33 WARNING (MainThread) [homeassistant.components.sensor] Setup of sensor platform weatheralerts is taking over 10 seconds. 2021-09-07 23:39:33 WARNING (MainThread) [homeassistant.config_entries] Config entry 'Home' for accuweather integration not ready yet; Retrying in background 2021-09-07 23:39:44 ERROR (MainThread) [custom_components.openei] Error fetching openei data: 2021-09-07 23:40:00 ERROR (MainThread) [custom_components.openei] Error fetching openei data: 2021-09-07 23:40:20 ERROR (MainThread) [custom_components.openei] Error fetching openei data: 2021-09-07 23:41:01 ERROR (MainThread) [custom_components.openei] Error fetching openei data:

Below are my Home Assistant and HACS environment details. I just found this integration and already purged old Docker images, so I do not know if this could be a breaking change in a recent build of the Home Assistant docker image.

System Health

version core-2021.9.4
installation_type Home Assistant Container
dev false
hassio false
docker true
user root
virtualenv false
python_version 3.9.6
os_name Linux
os_version 3.10.0-1160.41.1.el7.x86_64
arch x86_64
timezone America/Denver
Home Assistant Community Store GitHub API | ok -- | -- Github API Calls Remaining | 4202 Installed Version | 1.15.2 Stage | running Available Repositories | 945 Installed Repositories | 17
AccuWeather can_reach_server | ok -- | -- remaining_requests | 18
Home Assistant Cloud logged_in | false -- | -- can_reach_cert_server | ok can_reach_cloud_auth | ok can_reach_cloud | ok
Lovelace dashboards | 3 -- | -- resources | 7 views | 10 mode | storage
Tuxrug commented 3 years ago

I just found the following more verbose information in the docker container's logs that wasn't in the Home Assistant logs page:

2021-09-08 00:00:01 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved Traceback (most recent call last): File "/config/custom_components/openei/init.py", line 98, in _async_refresh_data self._data = await self.hass.async_add_executor_job( File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 52, in run result = self.fn(*self.args, self.kwargs) File "/config/custom_components/openei/init.py", line 116, in get_sensors _sensor[sensor] = getattr(rate, sensor) File "/usr/local/lib/python3.9/site-packages/openeihttp/init.py", line 166, in distributed_generation return self._data["dgrules"] KeyError: 'dgrules' The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/config/custom_components/openei/init.py", line 102, in _async_refresh_data raise UpdateFailed() from exception homeassistant.helpers.update_coordinator.UpdateFailed 2021-09-08 00:00:02 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved Traceback (most recent call last): File "/config/custom_components/openei/init.py", line 98, in _async_refresh_data self._data = await self.hass.async_add_executor_job( File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 52, in run result = self.fn(*self.args, *self.kwargs) File "/config/custom_components/openei/init.py", line 116, in get_sensors _sensor[sensor] = getattr(rate, sensor) File "/usr/local/lib/python3.9/site-packages/openeihttp/init.py", line 166, in distributed_generation return self._data["dgrules"] KeyError: 'dgrules' The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/config/custom_components/openei/init.py", line 102, in _async_refresh_data raise UpdateFailed() from exception homeassistant.helpers.update_coordinator.UpdateFailed 2021-09-08 00:00:02 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved Traceback (most recent call last): File "/config/custom_components/openei/init.py", line 98, in _async_refresh_data self._data = await self.hass.async_add_executor_job( File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 52, in run result = self.fn(self.args, self.kwargs) File "/config/custom_components/openei/init.py", line 116, in get_sensors _sensor[sensor] = getattr(rate, sensor) File "/usr/local/lib/python3.9/site-packages/openeihttp/init.py", line 166, in distributed_generation return self._data["dgrules"] KeyError: 'dgrules' The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/config/custom_components/openei/init.py", line 102, in _async_refresh_data raise UpdateFailed() from exception homeassistant.helpers.update_coordinator.UpdateFailed 2021-09-08 00:01:09 ERROR (MainThread) [custom_components.openei] Error fetching openei data: 2021-09-08 00:02:29 ERROR (MainThread) [custom_components.openei] Error fetching openei data:

coleya commented 3 years ago

This seems to match the error I posted on the most recent comment in #7.

firstof9 commented 3 years ago

Give 0.0.9 a go.

Jefe2 commented 3 years ago

When adding the integration in the UI, I was getting the "Retrying setup: None" error after selecting the Rate Plan (step 3). With 0.0.9, the integration is added successfully - no errors. Thanks!

Tuxrug commented 3 years ago

I am now able to select a rate plan and complete setup.

coleya commented 3 years ago

I am also now able to complete setup and all but the distributed generation sensor entities have values. Now I have to figure out why the rate is totally wrong (the rate changes once I personally cross a threshold of used energy in a month so this might be a lost cause). Thanks for fixing this.

firstof9 commented 3 years ago

@coleya if you go to https://openei.org/wiki/Utility_Rate_Database and pull up the plan page, could you link it, I'll see what data it provides.

coleya commented 3 years ago

Okay I think this is it. I was able to find it in the list at the very end of the selection menu and at the very top of the database link you sent me when I put in PG&E which makes me think it's the newest entry but doesn't explain why it's completely by itself or why there are multiple identically named rates called E-1 -Residential Service Baseline Region T. The ID I sent you initially was almost definitely wrong as it doesn't specify residential but when I select the rate at the very bottom of the selection menu (ID: 60e4c63a5457a3a91679e0f2) and click submit nothing changes and when I go back to set it up again the old ID that I sent you is back in the box.

firstof9 commented 3 years ago

Ok I'll double check that. Looks like you're on a tiered energy plan, I'll have to see if I can dump that data for testing.

coleya commented 3 years ago

Okay I reinstalled from HACS and resetup the integration and it now gives the (I think correct) tier one rate as the current rate and the all rates sensor just has that rate listed twice like [.25,.25] but with more digits of precision instead of having all three tiers. It would be nice to be able to switch the current rate sensor to each of the three tiers since I already have a sensor that measures the total energy consumed in the current month.

firstof9 commented 3 years ago

I'm working on a library update to work with a tiered plan right now.

coleya commented 3 years ago

The "Retrying setup: None" error is back after reinstalling from HACS because of the #26 update I've turned debug mode back on and I will post again at the top of the hour with the special traceback message.

firstof9 commented 3 years ago

Did you already try reconfiguring the integration as well?

coleya commented 3 years ago

I tried reconfiguring it after the update and adding the monthly energy usage sensor but after the rate didn't change at all I decided to delete the integration and reinstall from the HACS UI and when I set it up again I got this error.

firstof9 commented 3 years ago

Strange, let me know what error shows up in the log then. Thanks!

coleya commented 3 years ago

Here is the error:

This error originated from a custom integration.

Logger: homeassistant
Source: custom_components/openei/__init__.py:112
Integration: OpenEI Utility Rates (documentation, issues)
First occurred: 1:00:00 PM (24 occurrences)
Last logged: 1:00:01 PM

Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/config/custom_components/openei/__init__.py", line 108, in _async_refresh_data
    self._data = await self.hass.async_add_executor_job(
  File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 52, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/openei/__init__.py", line 128, in get_sensors
    _sensor[sensor] = getattr(rate, sensor)
  File "/usr/local/lib/python3.9/site-packages/openeihttp/__init__.py", line 116, in current_rate
    value = float(self._reading)
ValueError: could not convert string to float: 'sensor.power_myaddress_123_1mon'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/config/custom_components/openei/__init__.py", line 112, in _async_refresh_data
    raise UpdateFailed() from exception
homeassistant.helpers.update_coordinator.UpdateFailed
firstof9 commented 3 years ago

can you tell me the state of that sensor? Is it numeric?

coleya commented 3 years ago

the state is 111.333 and the attributes of the sensor are:

state_class: total_increasing
last_reset: '2021-09-08T19:31:56+00:00'
unit_of_measurement: kWh
friendly_name: myaddress 1,2,3 1MON
device_class: energy
firstof9 commented 3 years ago

Ah I see my error, lemmie drop a beta for you to test with.

firstof9 commented 3 years ago

0.1.2-b2 should have this sorted.

coleya commented 3 years ago

The error still seems to occur even after reinstalling I'll tell you at 2pm PDT if the traceback is any different.

firstof9 commented 3 years ago

If you add this to your configuration.yaml you can see the errors on startup:

logger:
  default: error
  logs:
    custom_components.openei: debug
coleya commented 3 years ago

I have that except for the default: error part in my config already. For whatever reason this error is only logged when that is in the config and it is at the top of the hour.

firstof9 commented 3 years ago

Weird, ok.

coleya commented 3 years ago

Here is the newest error:

This error originated from a custom integration.

Logger: homeassistant
Source: custom_components/openei/__init__.py:112
Integration: OpenEI Utility Rates (documentation, issues)
First occurred: 2:00:00 PM (35 occurrences)
Last logged: 2:00:00 PM

Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/config/custom_components/openei/__init__.py", line 108, in _async_refresh_data
    self._data = await self.hass.async_add_executor_job(
  File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 52, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/openei/__init__.py", line 125, in get_sensors
    readings = meter.state
AttributeError: 'str' object has no attribute 'state'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/config/custom_components/openei/__init__.py", line 112, in _async_refresh_data
    raise UpdateFailed() from exception
homeassistant.helpers.update_coordinator.UpdateFailed
firstof9 commented 3 years ago

Ok think I have it properly fixed now in beta 4

coleya commented 3 years ago

I updated and now the rate is at the highest tier even though I'm just realizing I think it ought to be on tier 1 right now with the value of the 1 month energy sensor (6.8 kWh /day * 30 = 204) I'm at 113 kWh so I'm below the baseline right now so in 92 kWh it should switch to tier 2 then once it reaches 400% of that baseline value it should go to tier 3.

firstof9 commented 3 years ago

I created a new issue for that. Since the setup issue is fixed now.

mattbruman commented 2 years ago

Hello I am getting this error now but only on my Rate 22 rates from my provider. I have removed and added it back but it gets stuck on the Retrying Setup: None https://apps.openei.org/USURDB/rate/view/5b4f66025457a3e322c6d674

The normal residental rate I can remove and setup over and over without a issue https://apps.openei.org/USURDB/rate/view/5b4f64115457a3297ac6d674

This error originated from a custom integration.

Logger: custom_components.openei
Source: helpers/update_coordinator.py:182
Integration: OpenEI Utility Rates (documentation, issues)
First occurred: 11:44:31 AM (25 occurrences)
Last logged: 12:27:47 PM

Error fetching openei data:
Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/config/custom_components/openei/__init__.py", line 117, in _async_refresh_data
    self._data = await self.hass.async_add_executor_job(
  File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/openei/__init__.py", line 153, in get_sensors
    value = getattr(rate, SENSOR_TYPES[sensor].key)
  File "/usr/local/lib/python3.10/site-packages/openeihttp/__init__.py", line 197, in current_adjustment
    adj = self._data["energyratestructure"][rate_structure][0]["adj"]
KeyError: 'adj'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/config/custom_components/openei/__init__.py", line 121, in _async_refresh_data
    raise UpdateFailed() from exception
homeassistant.helpers.update_coordinator.UpdateFailed