Hi, during cloudy days my solar system generation is all over the place, and due to not getting any feed in tarrifs, I would rather use all of the solar I produce. So HA is all set up and I can read the sensor for grid usage, but I can’t seem to even get one switch to work when the solar export is over a certain number, let alone do what I want. The idea is, two 2000w heaters and one 1000w heater.
So when export is >1000 turn on switch bedroom (1000w heater)
if export is another >1000, turn off switch.bedroom, turn on switch.living1 (2000w)
if export is another >1000, turn on switch.bedroom
if export is another >1000, turn off switch bedroom, turn on switch.living2 (2000w)
and finally if another > 1000 turn on switch.bedroom
Then of course turn them off in the reverse senario if grid_usage is >0
I’ve found some code in the forums for getting the grid usage out of the inverter and making it positive, but i’m a bit lost how to use it correctly. I tried the GUI with a simple automation but it doesn’t work with the few iterations i’ve tried. Here’s the code for getting the data out of the inverter, and when run in dev tools template, outputs the correct data.
I know i’ll need to use if and else satements and read the states of the switches which I can probably get my head around but i’m a bit lost as where to start. Any help and pointers welcome.
Just thought i’d update this as I’ve changed a few things today and got the sensors to work and have cards working on my dashboard. I’ve been trying both the official fronius platform and the HACS fronius_inverter platform. Both seem to work the same so for now i’ll stick with the official version and post up my configuration and automation files to see if anyone can work out why even my simple automation wont work.
Thanks koying, I had it that way before I added the state_attr but it didn’t work then either.re-edited and still no go. In the log is a weird thing. Three entries all with the same timestamp down to the second. bedroom heater turned off then bedroom heater became unavailable, then bedroom heater turned on.
But the switch doesn’t show as on.
OK,getting somewhere now. I just set the state to 1200w for grid_export (sun is going down so setting in developer tools) and the switch turned on.
I have to remove the condition of grid_use so I can test the automation by setting grid_export to >1000 in developer tools. Is that condition even needed really? I’ve now set the switch to turn off if grid_export is <1000. Here is my automation.yaml now which seems to be working ok.
Is there a more elegant way of doing this? To get the other heaters to turn on, do I just set conditions in the gui, or would I be better off writing the file manually with if else statements and testing states of other switches?
My logic brain is going to need help with this I think. I’ve gotten the turning on logic “almost” right, but the turning off logic is harder to work out. It’s the logic between having the 1000w heater on if grid_export is between 1000-2000 and switching which device on and off is what I am having trouble wrapping my head around. I’m not entirely sure I can do it in the automation GUI?
Here is my automation file so far. It works fine if I firstly set grid_export to >1000, bedroom heater comes on. Then if I increas it to >2000, living1 heater comes on, then I need to decrease it to below 2000 and again cross the > 2000 threshold for living3 to come on.
It’s setting the conditions with the 1000w heater vs the 2000w heater is the tricky part.