Haha that or line 1 needs to be one “tab space” forward (less changes required).
Spaces, indentations…highly frustrating but I think I got it right
I’ll test and see if it works
Thank you guys so much for helping me with this, I really appreciate it
I just keep my life simple and have my config files split, also keeps indentation happy. folder structures and filename help too, well once you exceed a number of automations and manually configured sensors/entities, my last count was 70 odd files just for automations, most relating to notifications and events
Definitely a more comprehensive setup than I have! Mine is limited to less than 10 automations of which most are updating inputs on my GUI if I change them manually on the GX.
It didn’t work
My battery was 88% and I set it to turn off the pool pump when > 89%
Back into the laboratory
Where is your 89% used, in the trigger, or the condition?
You mean less than 89%?
More then 89%
Yes, that is in the condition
- 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
Is Battery_SOC and pool_pump the names of your sensor and switch respectively? Those are just the ones I gave in my sample code.
Also, you say your battery was at 88%, but the code above says it wants to turn on at more than 90%, so it wouldn’t have executed the action yet?
This automation serves to turn on Switch.pool_pump
Have you made one to turn it off?
The switch doesnt automatically turn off.
Not yet…
I was just going to check that it does indeed turn it on…I can turn the pump off via ewelink so it won’t be running all the time
Im confused as this post states you expected it to turn off.
As @jykenmynie has said and I mentioned earlier, check what the names of the sensors and entities are. It does not look like you have changed it from his example.
Hmm, where can I check for the correct names of my sensors?
Would this be one? (from /config/sensors/04-victron.yaml)
What I have found easiest is to have multiple tabs open, one on the developer tools, search for the sensor and copy and past that name into the yaml
I also then have a tab open to check the configuration before rebooting, that is a crucial step as any configuration or syntax issues will cause HA not to boot.
You can also see the state of each entity on the developer tools page which will help you establish if the sensor is actually getting any data
Mine looks like this:
- name: Battery SoC
hub: victron
unit_of_measurement: "%"
slave: 100
register: 843
And then when I refer to it, I put underscores instead of spaces. So I think you are correct.
Have you output that sensor to your GUI to check its value?
*Edit: Never mind adding it to the GUI, didn’t know @Thaelian’s developer tools trick!
@Bobby You still just need to check the name of your switch for the pool pump.
I found this in the developer tools (quite useful section - I never used it before but will start using it )
This is the actual pool pump : switch.sonoff_1000d90a15
And gets managed via service : switch.turn_on or switch.turn_off
Battery state of charge is: sensor.battery_soc
Then you need to replace my “pool_pump” with “sonoff_1000d90a15”
Ok, so I compiled this (via the automations thing)…I will clean up the empty things
- id: ‘1626782260356’
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
from: ‘98’
to: ‘0’
condition: []
action: - service: switch.turn_off
data: {}
entity_id: switch.sonoff_1000d90a15
mode: single
- platform: state
- id: ‘1626782367495’
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
from: ‘99’
to: ‘100’
condition: []
action: - service: switch.turn_on
data: {}
entity_id: switch.sonoff_1000d90a15
mode: single
- platform: state
Now another question - I would like to use > and < rather then “from” and “to”
Can I do that (and how)?