Hi all,
so I have Victron stats and some minor switches integrated into Home Assistant but I would now like to do my first automation.
I would like to Switch my pool pump on and off based on Victron SOC.
Pool Pump is controlled via Ewelink switch that is integrated into HA.
I have tried to go to Configuration/Automation and attempted to create what I want but have failed
Slightly off topic; how are you finding the PoolSense? Thinking of getting one.
As for the automation; you can do that in the automations section of HA, and use the SOC as the trigger for the Pool pump. Do might want to use PV value as well. I have my pool come on when PV + SOC are above a certain level and then switches off when PV drops off.
PoolSense is ok and assists with keeping the pool water healthy
I would say it is useful as it was a chore to keep taking water samples to pool shops and those testing strips where a bit clunky for me. PoolSense tells you what you need to add to keep the levels right.
My pool water is clear so no complaints.
One of the downsides is that, as per their advice, the device battery last 2+ years and canāt be replaced so once done - you have to get a new one.
Have you tried looking at my code? I do something similar, change the inverterās max power based on the PV generated by the solar panels (before the SoC reaches 100).
It should help you with the syntax to get it going in your automations config file.
Iām not at all good at coding in HA, but it seems to get the job done.
Iām not great with YAML, but what worked for me was to have trigger the sensor that should be monitored (or the like) and the condition the state that should exist for the action to be taken.
You donāt seem to have any condition specified? You can see in my code where I called the condition that my SoC should be < 100 (for this specific automationās action to be executed).
This yaml doesnt do anything, there is no āActionā
Have you designed this in the UI or purely from yaml?
My advice is to use the developer tools and confirm you are looking at the correct entities.
Reading the yaml you are looking for a condition where a device tracker has a state of āOnā.
Is this correct?
Hi @C.Potgieter,
yes, this is created by Automations under Configuration. I donāt really know how to create this manually, I only search for things and then copy/paste
Ok, I will try to use ācall a serviceā or ādeviceā under Action
I noticed that as well that when created in Automation, there was no action next to the Triggerā¦
EDIT:
I just noticed that the when I select the device, there is no Actions defined (I am using the Sonoff LAN integration via HACS)ā¦
I also tried at first to use the āwizardā to make automations. I found it so confusing that I rather just figured out how to do it manually.
Steps:
Do you have all the sensors and switches loaded that you want to automate
Can you observe their values, switch them on and off manually
Understand really well what the conditions are you want for the automation - Really think about this, because many of these things are more complicated than you originally think. I find that I have this tendency to simplify something while thinking about it but when it comes to putting pen to paper, so to speak, I realise there is more nuance.
You donāt want the pool pump to go on and off constantly, for example, and donāt want the pool pump to go off when you manually wanted it to be on, etc. etc. etc. So many things to keep in mind. Really try and distill it down to the bare basics of what you need. Code that. Then add refinements as shortcomings become apparent to you.
Only now try and implement an automation yaml.
If you look at the code I wrote, you really want to do something very similar, perhaps:
- alias: Trigger Pool Pump
trigger:
platform: state
entity_id: sensor.Battery_SOC
condition:
condition: and
conditions:
- condition: sun
before: sunset
- condition: sun
after: sunrise
- condition: template
value_template: "{{ (states('sensor.Battery_SOC')|int) > 90 }}"
action:
- data:
entity_id: switch.pool_pump
service: switch.turn_on
Something like that? I donāt know what your pool pumpās name is. Mine would be āswitch.switch_pool_pumpā but I donāt use it in an automation yet. Thereās many HA wizzes (not me) on this forum and they have posted a lot of code already. That is where I learned everything I needed to know, just by reading their code and figuring out the syntax (partially - still a hit and a miss).
As an aside, all my SONOFF switches I flashed with Tasmota. Really easy, no soldering required. I find that it just works flawlessly on HA that way. Havenāt tried anything else though.
Yeah, you can just hold the pins inside the through-plated holes, and flash it quite easily. But I generally prefer to solder some pins into mine. The one exception was the RF bridge. There is no space to fit the pins under the big LED pad that sits on top of the board, and that is when I remembered that you flashed yours by just holding the pins to the holes
It was actually based on Jacoās suggestion! He helped me to get started with those Sonoffs. Theyāve been running great now for months. The one switching my pool pump has saved me so much time and hassleā¦
@Bobby I just thought of another situation you probably want to avoid: If you set your ESS mode to keep batteries charged, you probably donāt also want to turn on your pool pump after a whileā¦
I had to do some sniffing around, I flash my sonoffs, dont use them with sonoff lan.
My suggestion would be to use ācall a serviceā
the service you are calling is āswitch.turn_onā and you should be able to select the switch that youve added on your āmanagementā page
As a basic automation yes, this will work just fine, presuming you would have an automation to turn it off too based on soc or sunset. Ive seen some āsmarterā options, where the automation turns the pump on for 15mins and then turns it off again. Catering for a drop in SOC with a single automation. This way the pump only runs for 15mins and if SOC drops below 90 it wont switch on again until it reaches 90, as you trigger on ever state change for SOC.
One of the biggest learning curves for HA automations is trigger vs condition and when to use them, and knowing that sometimes you need to check your values in both.
For complex scenarios like a pool, nodered works great for automation too.