Octopus Energy Agile Tariff

Don’t worry. It’s worked so wonder if I was an issue with my API or something…

1 Like

After working for months, something has broken or changed. The sensors sensor.octopus_agile_current_rate, previous_rate and next_rate are no longer being created. Multiple reboots of the host haven’t worked. I have three HA instances and none of them are working. The rates table is there, so that element is working.
Any suggestions?

I’m not sure whether octopusagile looks at octopusagile.rates or octopusagile.all_rates to answer the question around current and next rate prices but what I have found is that unless it is able to answer the question about what the previous rate was it won’t answer the question about what the current or next rate is. The only way for that to happen is to wait until until the current clock time has advanced beyond the next half-hour increment so that it can look at the rates or all_rates and answer the question about what the previous rate price was.
Sometimes , when the above is not enough, and some entities are not being updated correctly I have had to restart both the HA supervisor and then once it has fully restarted the HA core. Then , as above , wait for the time to move on to the point where the integration should be able to answer all the questions about what the previous/current/next price rates are based on what values are present in rates or all_rates.
Hope that helps.

Same issue for me from what i can tell.

What version of HA and the integration are you running? Are there any errors in the logs? Have you upgraded lately?
The rate sensors should pull from the all_rates entity in the latest version of the integration, if this has no info in the attributes, try calling the update_timers service and waiting for the next half hour to turn over to see if that helps. Let me know how you get on :slightly_smiling_face:

My HA installs are on the latest build. However the problem did start on the previous version (May 2021) and then continued through to the June versions.

Any errors in the log or tried running the services? What version of the integration?

HI Mark

Updated to the latest version of the integration. I can see the all_rates entity is populated, data seems to match the old octopusagile.rates entity.

For me the issue isnt the rates but the consumption entities havent updated, for example octopusagile.monthly_cost shows 0.0. Yearly shows a figure but its a figure which hasnt moved for a month or so. This has then thrown my utility meter sensors out of wack.

However i dont know if the issue is the integration or my octopus account as i am also using Octopus Compare on my iPhone and that has stopped working also. I have reached out to Octopus but they have just said its a 3rd party app and we dont support it BUT they are having problems reading data from my meter and it can take some weeks to run diagonistics.

Hi all. I’ve just got this up and running, but have the same errors/issues mentioned by a few above. I’ve used HACS to get the integration up and running, and running latest version of HA.

current_rate = self.hass.states.get("octopusagile.all_rates").attributes.get(rounded_time_str)
AttributeError: 'NoneType' object has no attribute 'attributes'`

I’ve added a couple of lines to try and debug this further and it looks like the self.hass.states.get(“octopusagile.all_rates”) entity doesn’t exist, although I haven’t been able to work out any more than that.

@Markg if you want any more info or me to try anything else, let me know, more than happy to :slight_smile:

An update.
This is now working after ~24 hours running. I noticed that the agileoctopus.json file wasn’t there originally. I tried creating this manually but it caused a different error, so removed it again. It now exists with everything populating, so it’s either getting and processing the data which was failing, or possibly something to do with the agileoctopus.json not existing/getting created.

I thought you were on to something there. Particularly when I looked at my instances and saw that the agileoctopus.json file hadn’t been updated recently on two of them.
However removing the file and then restarting core did not result in the file being recreated. I went as far as rebooting the entire system, which caused one of the instances to create the file, but the sensors aren’t being created.
The only error I get is this, and only on the one instance which is generating the file.

2021-06-25 10:00:00 ERROR (SyncWorker_21) [custom_components.octopusagile] Expecting value: line 1 column 1 (char 0)

So I have that exact same error this morning when it was working fine yesterday. Do you have consumption enabled, as mine is erroring at:

Logger: custom_components.octopusagile
Source: custom_components/octopusagile/__init__.py:430

I am not using the consumption element. I am more interested in what is about to happen, as I had it turning off my car charger during the peak periods.
Nothing much in the logs either.

Have you tried calling the octopusagile.update_timers service manually and then waiting for the next half hour to turn over? The reason it sometimes takes a while to get going is that usually only gets called at around 1900 each day. That service will only succeed if all the timers can be populated, for example it’ll fail if you have a timer that needs rates from the next day that aren’t populated. The rates are populated from the all_rates sensor so check that is populated too.
There should be a bit more detail attached to the errors above, if you’re looking at the logs in the guy you might need to click to expand.

Calling the service manually does appear to work. I can see the half hour rates in another card without any problems and the file is being updated frequently. It is just the additional sensor values which aren’t being created/updated.
Logs wise, I am looking in the main Home Assistant txt file. There is nothing else other than what I posted. I do also get the Unmatched Consumption error, in case that is relevant.

Is there any update on getting this resolved? With the new Energy Features of HA 2021.8 the current cost is going to be something more people are interested in.

@scriven33, I’ve not been able to replicate your issue, are you able to share your config? Which version of the component are you using & how was it installed? How long are you leaving your insurance up for? Do You allow it s full day?

It appears that I completely forgot what the issue was.
The integration was installed via HACS. However when I put the sensor configuration in to configuration.yaml, I cannot restart HA - as it says “Platform error sensor.OctopusAgile - Integration ‘OctopusAgile’ not found.”
If I try to add it via Integrations GUI, the submit button is not active. Putting in text allows submit to pressed, but the same error occurs.

Config of the integration

octopusagile:
  region_code: "H"
  mpan: 2000xxx
  serial: 18Pxx
  auth: sk_live_XXX
  startdate: "2020-01-01"

Ah cool, hopefully it could be an easy fix for you then. You’ve not included your sensor config but I’ve assuming you’re using camel case. I had to change that a while ago to pass the auto tests in HACS. It should look like this:


sensor:
- platform: "octopusagile"

I think I did mention it somewhere above but it has got lost in the discussion.
Hopefully that’s it, let me know.

If I put that line in to the configuration, then I get the error about the integration not being found. I have to comment it out to allow HA to reboot correctly.

I have removed the component completely, rebooted HA and then reinstalled it and it is still not being found.

That is an installation from HACS