Automation and Solar diverts

So I have some automations working fine.

However this one fails to work and I really cant see the difference, it never fires even when the criteria is met.

Devices/entities display in a card fine.

However the below Automation never fires.

alias: Solar Divert Immersion
description: ""
trigger:
  - type: value
    platform: device
    device_id: 46ad23b767ecaa9ce330d3c9722cf55f
    entity_id: sensor.battery_state_of_capacity
    domain: sensor
    above: 98
condition:
  - type: is_power
    condition: device
    device_id: 021612e7da99030627f930887e4bb88b
    entity_id: sensor.inverter_input_power
    domain: sensor
    above: 3000
action:
  - type: turn_on
    device_id: cd47a113b5f9c4c423beff1afa3b7a54
    entity_id: switch.sonoff_100168ab4d
    domain: switch
  - delay:
      hours: 0
      minutes: 1
      seconds: 0
      milliseconds: 0
  - type: turn_off
    device_id: cd47a113b5f9c4c423beff1afa3b7a54
    entity_id: switch.sonoff_100168ab4d
    domain: switch
mode: restart

I have been staring so long I am now blind, please help.

I forgot to add, to anyone who has contributed to HA in any way. Bravo you’re amazing!

Your automation will only trigger when your battery state goes from below 98 to above 98 % SOC and then the actions will only occur if your input power is above 3000 W.

Also while easy for beginners device automations have a major problem and you should avoid them.

1 Like

Use value templates rather that numeric triggers.

1 Like

Also I use this to do the same job with my immersion :

https://community.home-assistant.io/t/pv-solar-excess-optimizer-auto-control-appliances-wallbox-dish-washer-heatpump-based-on-excess-solar-power/552677/170

1 Like

Ok so, the automation will only trigger while passing through those conditions?

" Your automation will only trigger when your battery state goes from below 98 to above 98 % SOC and then the actions will only occur if your input power is above 3000 W."

How about making the automation check continuously for criteria, can i do that? I am looking at this wrong?

That is not required and you have linked to an unrelated post.

Yes you can, like this:

alias: Solar Divert Immersion
description: ""
trigger:
  - platform: state
    entity_id: sensor.battery_state_of_capacity
    to: # a null "to" triggers on all state changes of this entity.
condition:
  - condition: numeric_state
    entity_id: sensor.battery_state_of_capacity
    above: 98
  - condition: numeric_state
    entity_id: sensor.inverter_input_power
    above: 3000
action:
  - service: switch.turn_on
    target:
      entity_id: switch.sonoff_100168ab4d
  - delay:
      hours: 0
      minutes: 1
      seconds: 0
      milliseconds: 0
  - service: switch.turn_off
    target:
      entity_id: switch.sonoff_100168ab4d
mode: restart

One more word of advice. Edit your switch entity_id to change it to something descriptive (e.g. switch.location_function) before you start using it in automations and dashboards.

It’s not an unrelated post, it’s a blueprint to do the job he wants…

Then you should have linked to the first post, not a post asking for help.