I think I got it right this morning (was testing and looks like it was working )
- id: '1626842943289'
alias: Pull Pump ON by the SoC
description: This automation turns the Pool Pump On based on Victron Battery SoC
trigger:
- platform: state
entity_id: sensor.battery_soc
condition:
- condition: numeric_state
entity_id: sensor.battery_soc
above: '85'
- condition: sun
before: sunset
after: sunrise
action:
- service: switch.turn_on
entity_id: switch.sonoff_1000d90a15
mode: single
- id: '1626843326842'
alias: Pool Pump OFF by the SOC
description: This automation turns the Pool Pump Off based on Victron Battery SoC
trigger:
- platform: state
entity_id: sensor.battery_soc
condition:
- condition: numeric_state
entity_id: sensor.battery_soc
below: '99'
- condition: sun
before: sunset
after: sunrise
action:
- service: switch.turn_off
entity_id: switch.sonoff_1000d90a15
mode: single
I generated this using Automation under Configuration and also code editor
I have now learned where to check entities and actions, so it was a nice school
Good! Glad it is working and hope that we at least pointed you in the right direction.
Maybe a tip from my side would be to add your automation to the HA GUI. Then you can turn it off when you don’t want it to interfere. It will appear like a switch that you can toggle.
@Bobby have you checked that both automations dont fire at the same time?
It seems like you are creating a condition where they should, as when SOC is between 85 and 99, you are turning it on and off?
I guess due to this I find SoC not the most useful indicator to use when wanting to determine my electricity usage. A much more important factor is the current PV production, or product potential. SoC will be a fall back indicator should I really want to run my pump, but there just isn’t any PV available.
Hmm, your logic is sound…I clearly wasn’t thinking straight
I changed to:
- id: '1626842943289'
alias: Pull Pump ON by the SoC
description: This automation turns the Pool Pump On based on Victron Battery SoC
trigger:
- platform: state
entity_id: sensor.battery_soc
condition:
- condition: numeric_state
entity_id: sensor.battery_soc
above: '98'
- condition: sun
before: sunset
after: sunrise
action:
- service: switch.turn_on
entity_id: switch.sonoff_1000d90a15
mode: single
- id: '1626843326842'
alias: Pool Pump OFF by the SOC
description: This automation turns the Pool Pump Off based on Victron Battery SoC
trigger:
- platform: state
entity_id: sensor.battery_soc
condition:
- condition: numeric_state
entity_id: sensor.battery_soc
below: '98'
- condition: sun
before: sunset
after: sunrise
action:
- service: switch.turn_off
entity_id: switch.sonoff_1000d90a15
mode: single
Next is Telegram and notifications
Even an email would work as I have emails to push notification service that I use for various things.
I use google, so I created a app. specific password.
I use this to send emails from various systems, e.g. paradox alarm, victron, etc…all the emails I send to email to push notification service.
So far, not blocked hope to stay that way
Done and working well
Pool Pump turned on when SoC was 99% (cause 99 is above 98).
Next (silly) question, how can I set a precise value?
I wanted to be on when its exactly 98% and off when its 99%?
@Bobby I would just adjust your numeric state by a factor of 1. ie look at 97 and not 98.
I say this because using state for numeric values could cause a scenario where the state never happens.
In the case of something like battery SOC, depending on your capacity and loads, if you were to suddenly have high demand, SOC could drop more than a factor of 1. Ie from 100 to 97, as it never reported the 98, your automation wont fire, because in theory, it never happened.
Can I maybe use less then 100 for the Switch OFF automation?
So as soon as its less then 100, it will turn off
Basically, my intention is to run the pool pump as soon as the battery is full as when not running, I am getting just over 1kw for the charge.
EDIT:
I did see my SoC dropping to 99% now as the washing is on and toaster is on and a few other things that brought the SoC down, so I will adjust the values to as you said, 97
No, you are correct about the sensitivity of it, I just had 99% for a brief minute and it went off and then on when charged back to 100%.
- id: '1626842943289'
alias: Pull Pump ON by the SoC
description: This automation turns the Pool Pump On based on Victron Battery SoC
trigger:
- platform: state
entity_id: sensor.battery_soc
condition:
- condition: state
entity_id: sensor.battery_soc
state: '100'
- condition: sun
before: sunset
after: sunrise
action:
- service: switch.turn_on
entity_id: switch.sonoff_1000d90a15
- service: notify.home_assistant
data:
message: Pool Pump is ON
title: Home Assistant
mode: single
- id: '1626843326842'
alias: Pool Pump OFF by the SOC
description: This automation turns the Pool Pump Off based on Victron Battery SoC
trigger:
- platform: state
entity_id: sensor.battery_soc
condition:
- condition: numeric_state
entity_id: sensor.battery_soc
below: '97'
- condition: sun
before: sunset
after: sunrise
action:
- service: switch.turn_off
entity_id: switch.sonoff_1000d90a15
- service: notify.home_assistant
data:
message: Pool Pump is OFF
title: Home Assistant
mode: single
How does this look, it it better to avoid accidental off/on states?
That should turn the pump on when state reaches 100 exact and turn off iv it ever dips below 97. gives you roughly a 4% margin, as it will only turn off at 96.
@Bobby like old Cleggie says, however it does not apply to numeric_state, now if you wanted something like this, there are various workarounds. A simple version of this would be to create a template sensor that turns on when its below 96 and off when is above, and then you can check if that sensors state has been on for x amount of time.
An alternative would be to use nodered for complex automations.