markgdev / home-assistant_OctopusAgile

Octopus Agile custom component for Home Assistant
Apache License 2.0
86 stars 33 forks source link

Update for previous, current and next rates fails #95

Closed theantispam closed 1 year ago

theantispam commented 2 years ago

I'm relatively new to Home Assistant, particularly third party plugins so please excuse my ignorance.

I seem to be having issues getting anything out of the previous, current and next rate entities. I have looked in the logs and they appear to be throwing the same error messages. They all seem to complain about "AttributeError: 'NoneType' object has no attribute 'attributes'"

Here is the error output for the current rate:

2022-06-23 16:43:53 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.octopus_agile_current_rate fails Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 515, in async_update_ha_state await self.async_device_update() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 743, in async_device_update raise exc File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, **self.kwargs) File "/config/custom_components/octopusagile/sensor.py", line 159, in update current_rate = self.hass.states.get("octopusagile.all_rates").attributes.get(rounded_time_str) AttributeError: 'NoneType' object has no attribute 'attributes'

I have copied your example config and updated with my details, API key, etc. That's all gone in configuration.yaml (that's right isn't it?). I'm not sure what else you need to know but here are the versions I'm running:

Home Assistant: Core 2022.6.6 Octopus Agile Component: 0.1.1

I have checked the Entities list and everything appears to be there. Entities like monthly_cost and monthly_usage have values attached to them.

If you need any more info please let me know.

Thanks, James

MycroftVonLipwig commented 1 year ago

I get exactly the same and have done it the same way as you. I am newish to HA and this is the first time I have had to modify configuration.yaml. Assuming I have done it correctly to as followed the example.

I tried with Octopus Agile Component: 0.1.1 and now with Octopus Agile Component: 0.1.2.beta3. Same issue word for word.

I assume parts are working though as I can see the sensors and some seem to work, such as Agile Min Rate. Current, next and previous are all "Unknown"

MycroftVonLipwig commented 1 year ago

Ok. Updated to 0.1.3.beta.1 and all fixed. Either this is coincidental or you are the kindest/quickest dev that ever was. :-) Thankyou!

markgdev commented 1 year ago

I take no credit! Somebody else pushed up some changes to account for different tariffs the other day, I had merged but forgot to do a release to make it available through hacs. I don't actually have agile anymore so any dev on my part is very difficult, I need to find someone to take on the project!

MycroftVonLipwig commented 1 year ago

Ah ok. Well Thank-you to the community too then! Hopefully someone in the Octopus forums would be willing, seems like there is skill there. I can promote in the GivEnergy forum as Agile is a big topic there along with HA integration/control of the Inverters/batteries.