I really should be able to do this but it’s just not triggering and I can’t figure out why.
I want an automation to :
It isn’t triggering and I’m sure it’s something silly but I’m not seeing it…
I want an automation to :
- Trigger when <75min to load shedding (assessed with a sensor which I have and can be read)
- Check if it’s nighttime (defined as 2h prior to sundown until sunrise)
- If it’s nighttime - check battery percentage
- If <55% then send MQTT message to Victron to charge battery
- If it’s daytime (sunrise to 2h prior to sundown)
- Check battery percentage
- If <40% then send MQTT message to Victron to charge battery.
It isn’t triggering and I’m sure it’s something silly but I’m not seeing it…
YAML:
alias: Draft set inverter
description: ""
trigger:
- platform: numeric_state
entity_id: sensor.eskomcalendar_emmarentia_mins2loadshedding
for:
hours: 0
minutes: 0
seconds: 0
value_template: ""
below: 75
condition:
- condition: or
conditions:
- condition: and
conditions:
- condition: sun
before: sunrise
after: sunset
after_offset: "-02:00:00"
- condition: numeric_state
entity_id: sensor.victron_battery_level
below: 55
- condition: and
conditions:
- condition: sun
before: sunset
before_offset: "-02:00:00"
after: sunrise
- condition: numeric_state
entity_id: sensor.victron_battery_level
below: 40
action:
- service: modbus.write_register
data:
address: 2900
slave: 100
hub: victron
value: 9
- delay:
hours: 2
minutes: 0
seconds: 0
milliseconds: 0
- service: modbus.write_register
data:
address: 2900
slave: 100
hub: victron
value: 10
mode: single