Octopus Energy Agile Tariff

Have you had a look at the octopus energy apps on IOS?

I don’t own any but bought a iphone se to play with them for curiosity, there is 2 developer that have apps that show you next to the units how much you get payed per hour, pretty intutitive, shame none are available for android yet

android has a rates app which is nice though, good backup if my ha is down from me messign about :stuck_out_tongue:

Nice find, thanks for the link. I’ve just started peeking at the extensive documentation and see that the region can be reduced to postcode :smile: That may be a bit over precise but it looks fun in a card.

I have modified the code in order to turn on our water heater as it requires a different service but would have thought it easier if the configuration contains the service rather than having it hard coded. I only started with Home Assistant at the weekend so maybe I am wrong and should just create a custom switch for the timers and moneymakers.

if entity_id.startswith("climate"):
	if times[rounded_time_str]["params"] is not None:
		params = times[rounded_time_str]["params"]
		temp = params["temp"]
		_LOGGER.warning(temp)
		hass.services.call("climate", "set_temperature", {'entity_id': entity_id, "temperature": temp})
	else:
		_LOGGER.error(f"{entity_id} does not have any params set, don't know what to do")
elif entity_id.startswith("water_heater"):
	if times[rounded_time_str]["params"] is not None:
		params = times[rounded_time_str]["params"]
		operation_mode = params["operation_mode"]
		_LOGGER.warning(operation_mode)
		hass.services.call("water_heater", "set_operation_mode", {'entity_id': entity_id, "operation_mode": operation_mode})
	else:
		_LOGGER.error(f"{entity_id} does not have any params set, don't know what to do")
else:
	hass.services.call('switch', 'turn_on', {'entity_id': entity_id})

Personally I keep the device switching on/off in automations, and then use the Octopus best time periods as triggers for the automations.
And then have separate automations for if the price goes below certain points to trigger switching on/off other devices.
So I use the integrations like simple building blocks and the real power is in the HA automations.

1 Like

I came to the same conclusion after looking at your example in the github issue, I have a couple of ideas on how to do that and the reversion back to “normal” at the end of a period. I’ll try and get them added to the issue soon to see what you think.

Thanks Mark. I have also been messing around with a card for displaying the timers. It is a complete rip of your rates card and needs some work but useful for me. I added a unique class to the parent table so the styles don’t clash.

https://hastebin.com/emocojoqan.js

Thanks. I just need to read up on automations but agree it seems like the best way to do it as it keeps the home specific stuff out of the integration.

Octopus Watch is now on Android, as far as I can tell it has more or less the same functionality as the iOS version:

Thanks I actually found it last week and sent the iphone back (28 days returns on musicmagpie)

Its missing a feature from the other app on ios though octowatch I think it was called, you could see the usage per hour and house much is cost you.

hopefully they are going to add it

Loving the work and effort put into all this. I’ve got the Octoblocks set up beautifly with AppDaemon.

However I’m facing an issue with the OctopusAgile by Markg. It’s more than likely my error. I’ve dumped the folder into config\custom_components from the github, changed its name to OctopusAgile - when adding the intergration I’m seeing the below

Can anyone give me a bump stear in the right direction please?

Thanks.

Hi Adam, where are you seeing that view? Do you see all of the octopusagile.* entities in Developer tools -> States?

Hi Mark,

When I looked at config_flow i had assumed I would add the intergration via config - intergrations - add intergration - guessing I was wrong :grin: I dont see any octopusafile.* entities in states.

Begs the question, how do I pass through my API key, MPAN, and serial?

That makes sense, I haven’t implemented config flow yet, to be honest I was only aware of it recently!
You’ll need to add the config to your configuration.yaml, the minimum config should be this:

OctopusAgile:
  region_code: "L"
  mpan: 00000000
  serial: 00000000
  auth: abc00000000
  startdate: "2020-05-08"

If it fails to load you might also need to add an empty timers, moneymakers and run_devices section similar to the example in the readme, I’m not too sure how well things will work without them.

I realized that the auth, serial, mpan and start date weren’t in the readme, have just added them.

2 Likes

Hi @Troon - Love the look of your dashboard. Is your graph of agile costs is historic or forward looking? If it is forward looking, how did you achieve this?

Currently, I’m using @Markg’s component and agile rates card, which is great. However, I would love to show a forward looking graph instead but all HA graph components I’ve found are historic sensor graphs. Any ideas from the community on how to achieve this would be great.

Thanks

It works fine to pull in agile rates without the timers, moneymakers and run_devices sections as that is how I currently have it running (thought to be fair only had it running 12 hours). There are some errors in the logs about these missing section though when some of the updates run.

1 Like

Working great now! Thank you for your time. I had to add the empty timers, MMs, and run_devices section. No biggie. - no I didnt

On a side note I’m seeing “Unable to find services.yaml for the octopusagile integration” in logs. I’ll have a look to see if I can figure out why.

It’s historic, I’m afraid. I’ve now removed it as it wasn’t much practical use, and integrated a power meter into the page:

1 Like

Awesome, I have put an issue in for ignoring the timers etc and will do the same for services.yaml error, it’s because I’ve not populated the file.

1 Like

HI

I am new to HA I only set it up today.

I’ve read through this post (which took a while) and i’m confussed.

  1. Is there a step by step guide for me to add Octopus Agile pricing in to HA?

  2. I added “tesla powerwall” integration, what would i do so if octopus pricing is less less or equal to zero then change tesla powerwall to backup only (so it starts charging from the grid) then if it goes above 0 change to self powered.

Hi chris, there are a few ways to do it. One of them is a component I’ve been working on, there is a readme here: https://github.com/markgdev/home-assistant_OctopusAgile, if you only want pricing then you can leave the timers, moneymakers and run_devices sections of the yaml empty. There is also a custom card here: https://github.com/markgdev/home-assistant_OctopusAgile/tree/master/custom_cards to display the rates. I’ve tried to make the readme step by step but any issues let me know and I can try and help.