Works fine. The issue I’m having is how to turn off the appliances when prices go back above 0. I could just write an automation identical to the one above, but changing “below” to “above” and “on” to “off”. This would work to turn off the appliances, but then it would keep on turning them off whenever they were turned on if the price was above 0. So I need some sort of condition to say “while” prices are below zero, “do this” but can’t find the code that will do this.
Thought I’d be better replying to this rather than starting a new thread…
I’ve done something broadly similar to this, although I created two scenes for “Plunge time” and “Plunge finished” to turn everything off/on. Code below…
The issue I have is, it only seems to trigger once. Plunge pricing is often in two or more separate half hour periods, and this only ever seems to trigger in the first one. I’ve checked the sensor values and all looks good. Am I missing something here?
Your Numeric State Trigger will trigger at the moment the sensor’s value decreases from above 0.01 to below 0.01. In other words, the moment it crosses the threshold of 0.01.
It won’t trigger again until the sensor’s value first increases above 0.01 then decreases below it.
Therefore after it triggers the first time, it won’t trigger again no matter much more the sensor’s value continues to decrease below 0.01. It’s the act of crossing the threshold value (0.01) that causes it to trigger.
Thanks for the reply. Unfortunately I haven’t got the data from when it last happened, but the unit price sensor did indeed increase between the plunge periods. The intent of the automation was “when electricity is free or less than free, turn stuff on until it isn’t” which is why I was targeting less than 0.01 rather than negative rates only which I think is the OPs intention.
I have a sneaking suspicion that although the rates did increase between plunge periods, it might not have been by enough, I had mistakenly assumed the sensor unit was in pence like it appears on the Octopus rate card, but it’s pounds… I think if I change it to 0.000001 or something similarly low, that should achieve what I’m after.
Obviously now there won’t be a plunge period for the next 6 months to prove the theory