Octopus Energy Agile Tariff

With a bit of luck they appeared for you about an hour ago. They get updated at 1900 each day with the timers. If you ran the update_timers service they should also get created, but only if the next days rates are already available, I haven’t worked out the best way to work around the rates not being available yet if you ran it earlier in the day.

Great. Thanks !
They are there now.

1 Like

@Markg
Is there any way that the sensors could restore their previous values after a restart?
I’m constantly tinkering and restarting and it means the average sensors disappear for hours at a time.
I guess I could store them and restore them, but seems more sensible for you to do that in your code?

Also a curiosity question, is there a reason you have your sensors as octopusagile.xxxx

rather than them being sensor.octopusagile_xxxx

Thanks

I will get saving the sensors to save/restore, I thought about it yesterday when I said you’d have to wait until 7 for them to populate, it was a bit lazy of me to not have done that when I implemented them.

I think the way I went about it was similar to the climate device where you have a main domain object with the base info and other sensors separately (like temperature in climate devices). The avg entities should probably have been in the sensor domain thinking about it, I made a copy/paste error!

Look forward to the updates.

Thanks !

Hi there
I am very new to this game, so please forgive if I am asking daft questions.
I have installed this Octopus Agile integration successfully in my instance of Homeassistant OS, and was hoping to use the moneymaker part to start my Melcloud (Mitsubishi Ecodan) hot water.
Problem is, I don’t think it is a switch to start it - as far as I can see it is a service to change the operational mode to force_hot_water.
Is it possible with this setup?
If so can I make a call to a service with the moneymaker, or could someone show me how to start the Melcloud hot water with a switch?
Many thanks
Andy

Not sure what you are saying here. Leaving aside the OctopusAgile integration how does HA switch on the hot water heater ? If you post the yaml , things may be a little clearer.

Sorry, I was a little unclear how it worked but think I am on it now.
The yaml is as below - the sensors are working, the run_devices are working, but for some reason the timer boolean doesn’t seem to be… I replaced the boolean with a simple smart plug switch too, but it didn’t fire either. Not sure about the money maker, but then the prices aren’t anywhere near zero at the moment!
Is there any reason the boolean/timer wouldn’t be working?

octopusagile:
  region_code: "P"
  mpan: ********
  serial: **********
  auth: sk_live_****************
  startdate: "2020-01-26"
  moneymakers:
  - input_boolean.hotwater_to_60: null
  - climate.home_zone_1: 
      params:
        temp: 22
  timers:
  - day_from: today
    day_to: tomorrow
    entity_id: input_boolean.hotwater_trigger
    numHrs: 1.5
    params: null
    time_from: '22:00:00'
    time_to: '06:30:00'
  run_devices:
  - energy_time: 1.5
    entity_id: hotwater
    run_before: '06:30:00'
    run_time: 1.5
  - energy_time: 2.5
    entity_id: tumble_dryer
    run_before: '09:00:00'
    run_time: 2.5
    
sensor:
- platform: "octopusagile"

It’s a fantastic bit of integration though, and one of the main reasons I jumped in with Home Assistant. So it is great to - nearly - have it working!
Many thanks for any help
Andy

The way Home Assistant works, you’d usually do all of this in Automations. So you’d have a trigger, some thing like entity = sensor.octopus_current_price, trigger type = numeric, trigger = below 0. And then an Action, which could be a call service, which might have a target entity of your water heater, along with the service data that the service needs, which could be a mode setting.
But I think Mark’s octopusagile integration tries to do this all itself.

Yes, I was going to use the input_boolean.hotwater_trigger to call the service that changes the Ecodan hot water mode to ‘force_hot_water’
But it doesn’t seem to be triggering. I saw someone above mention a problem with half hours, could it be that there is a problem with me asking for 1.5 hours power?
Cheers
Andy

I was thinking more about the yaml that related to the automation, as badguy was talking about, rather than the configuration of octopusagile but OK.
Anyway looking at that config , my first thought is that given your time range you will need to wait until at least ( approx) 1600 hrs for the time range to be available and then wait untill 1900 for the update_timers service to automatically populate the octopusagile.timers entity ( you could manually call the service after 1600 - or whenever octopusagile.rates has some values that covers your time range ). If having done all that octopusagile.timers entity has some valid values you can then go on to the next stage which would be moitoring the state of your input_boolean.hotwater_trigger, You should see those values changing on/off as per the schedule, Marks automation should do this for you. If you do see those values changing ( use Logbook to specify time frame and enitity - if you are not doing so already ) then you can use that state change to trigger an automation that actually switches on your device. By choosing to go down the input_boolean route you will have to create that automation yourself ( te be pedantic you would need at least two automations of course , one to switch the device on when the state changed to on , and one to switch it off when the state changed to off ). If you had chosen to refer ( or could have reffered ) to the water heater by its entity_id , and that entity could be switched on with a call to the switch.turn_on service then Marks automation would have done that for you.

1 Like

Ahh sorry. I haven’t been using the automation yet, I am just at the testing stage of the boolean ‘switch.’ I didn’t want to wake up in the morning without hot water!
I did set it running last night and nothing happened through the night as I had hoped. I couldn’t find any ref to the input_boolean.hotwater_trigger in the logbook, good or bad.
I’ll check again in the morning to see.I did create the timer late last night, so maybe it missed the window for collecting values?
Many thanks again for looking at this. I’ll report back.
I could also try the straight switch - the water heater entity is called water_heater.home, so I would enter ‘entity_id: switch.water-heater.home’?

Ahh, it isn’t available as a switch in the entities,so I guess that approach isn’t an option.

Right - it ran perfectly last night, activating the boolean at 0500 for 1.5 hours.
I suspect it had been created too late the night before to scoop up the rates.
Now to work it into the automation. Many thanks for all your help!
Cheers
Andy

Glad you got sorted! The timers get updated at 1900 each night, if you want to force them to update after that you can call the octopusagile.update_timers service from the developer tools tab, just beware that if you call that when there are no rates available for the time period, it’ll fail.

Does anyone know how to stop these errors ?I;ve tried restarting HA core but to no effect . I have not changed anything in my config of octopusagile in a few weeks and this has only been happening in the last 3 days. Is there a way to disable the calculation of ‘consumption’ if it is gpoing to be doing this ?

2021-01-31 17:00:40 ERROR (SyncWorker_0) [OctopusAgile] Unmatched consumption 2021-01-30T21:00:00Z / cost 2021-01-29T21:00:00Z

2021-01-31 17:00:40 ERROR (SyncWorker_0) [OctopusAgile] Unmatched consumption 2021-01-30T21:30:00Z / cost 2021-01-29T21:30:00Z

2021-01-31 17:00:40 ERROR (SyncWorker_0) [OctopusAgile] Unmatched consumption 2021-01-30T22:00:00Z / cost 2021-01-29T22:00:00Z

2021-01-31 17:00:40 ERROR (SyncWorker_0) [OctopusAgile] Unmatched consumption 2021-01-30T22:30:00Z / cost 2021-01-29T22:30:00Z

2021-01-31 17:00:40 ERROR (SyncWorker_0) [OctopusAgile] Unmatched consumption 2021-01-30T23:00:00Z / cost 2021-01-29T23:00:00Z

No idea but I’ve often found with this integration that of you delete /config/octopusagile.json and restart it can help.

You’re the second person to ask about this this weekend, odd it’s not come up before. Do you have any missing data by chance? I need to revisit the consumption cost as when I merged it in from octocost I didn’t do the best job and am not too confident that I got it all right.

My guess would be the consumption data for 29th Jan is missing.

1 Like

If I ‘Explore My Energy Use’ on my Octopus account page I can only go back as far as the 27th for some reason , though everything from the 27th forward is complete as far as I can see. Don’t know why this is , I’m sure I could go back earlier than that before . Looking at the home-assistant.log file the problems seem to start from these dates/times :

2021-01-31 16:12:25 WARNING (SyncWorker_4) [custom_components.octopusagile] Timer didn't exist
2021-01-31 16:30:14 ERROR (SyncWorker_2) [OctopusAgile] Unmatched consumption 2021-01-26T23:30:00Z / cost 2021-01-25T23:30:00Z
2021-01-31 16:30:14 ERROR (SyncWorker_2) [OctopusAgile] Unmatched consumption 2021-01-27T00:00:00Z / cost 2021-01-26T00:00:00Z
2021-01-31 16:30:14 ERROR (SyncWorker_2) [OctopusAgile] Unmatched consumption 2021-01-27T00:30:00Z / cost 2021-01-26T00:30:00Z

I always get the ‘Timer didn’t exist’ error when starting octopusagile after a Core restart, I assume because the moneymaker is empty. No idea why it starts with an ‘unmatched consumption’ referencing the 26th and 25th though.
Also I did try the trick of deleting the octopusagile.json file , more in hope than expectation honestly, and on this occasion it had no effect at all.