Automation for power sensor

Hi,

I have Shelly 1PM device and I would like to get notificatin when power drops from >100W to 0W and stays at 0W for ten minutes.

I arelady set device automation with device trigger below 100W but I get notification also when power drops from 2W to 0W.

Haw can I set this automation?

Thanks for your answers.

You can try a template condition, something like:

trigger:
  - platform: state
    entity_id: sensor.shelly_power
    to: 0
    not_from: unavailable
    for: "00:10:00"
condition:
  - condition: template
    value_template: "{{ trigger.from_state.state|float >= 100 }}"

However this is completely reliant on the state value dropping immediately from > 100 to 0… anything less can lead to false-negatives.

:thinking:


trigger:
  - platform: numeric_state
    entity_id: sensor.shelly_power
    below: 1
condition:
  - condition: template
    value_template: "{{ (as_timestamp(now()) - as_timestamp(states.sensor.shelly_power.last_changed)) > 600 }}"
action:
  - service: notify.notify_xxxx
    data:
      message: "Power has dropped to 0W for 10 minutes."