Hello, my first question, I am stuck getting this automation to work. I am new to HA and have limited experience but I have tried to alter it below from 0.01p to 0.001p etc but I do not know what I am doing wrong. When Agile falls below then nothing triggers. Can anyone help direct me please?
If your units are really pence per kilowatt hour (kWh to capitalise it correctly), you are pretty much asking it to only switch on when the Agile price goes negative.
Far from being an expert, but at first glance, it seems round(2) is your problem. You won’t get granularity from 0.01 to 0.001 unless you change that to round(3)
Agreed — but the main problem is that the Octopus API returns costs as pence per kWh, but the value in the automation suggests that the OP has written it to be in £ per kWh.
If that’s really meant to be below 1p then above 2p per unit, it should be 1 and 2 not 0.01 and 0.02.
Hello, I have tried changing the settings within the code, eg, 0.01, 0.1, 1, 1.00 but it does not trigger when the price falls below, If I run the automation directly then it works as it should but wont trigger on price. Thanks
You have a bit of a strange setup for updating. The sensor you have updating once a day (sensor interval) but then you have an automation with a bit of a wacky time pattern to force an update… Looks like it’s trying to do so every 30 mins?
what if you change the scan_interval to 1800?
id first do that and make sure that the sensor actually updates … if it does then we can make sure the automation triggers
Has the price fallen below 1p/kWh? Show the history graph of the sensor. You’re grasping at straws without that data.
The entity ID in your Rest sensor does not match the one in your automation. Have you just copy/ pasted a load of code? If the config above is everything, you’re asking the automation to trigger off a non-existent sensor.
So i checked the sensor, when I manually turn it on it works so its not the swtiches, but from this picture, the agile rate does not update as it should do and I guess this is the issue,
It’s one of the issues. The other main one is that your numeric state triggers are watching sensor.octopus_energy_cost_tracker_agile and I don’t think you even have that sensor.
I’m completely stuck, just giving up on it now, I really dont have the knowledge to find whatever it is is wrong (despite extensive time spent), but thanks for your time and input anyway.
Now I’m in front of a real computer (rather than replying on a phone) let me try to give a bit more help. I think this can be all fixed with one change to the code.
However, the automations that do the half-hourly updating and the switching on and off are both looking at sensor.octopus_energy_cost_tracker_agile which, as far as I can tell, doesn’t exist on your system.
So change the name line in the code above to read:
Next make sure your automations’ below and above lines to something that makes sense for pence per unit, perhaps below: 1 and above: 2 or even higher for testing.
Then restart your system (or do a YAML reload if it asks you).
Thanks for your patience, I will give this a go later tonight when I get back in from work, I will obviously change the values to mirror the current rates at that time to see if it works.
Many Thanks.
Hi, I’ve tried this tonight, with values 16, 0.16, 0.0.16 but still does not trigger automatically, I’ve attached some screenshots so you can see my basic setup, not sure what could be wrong…