Can't trigger Plug For Zero Grid Power

Hello Peeps. I’m a noob but have managed to configure my Sonoff Zigbee dongle. I’ve attached a Smart Things plug to a dehumidifier. I initially set it up with ‘Automation’ UI to switch on if Solar Gen went above 1000w for five mins and off if it went below 1000 for 5 min and it worked.
Then I decided it would be better if it went on when Grid Draw was at zero ie exporting.
I set Automation to switch on if Grid Power was below 1 for 5 mins and off if above 1 for 5 mins.
Heres the on bit in YAML

alias: Grid Draw Below 5 for 5 min
description: ""
trigger:
  - platform: numeric_state
    entity_id: sensor.smart_meter_electricity_power
    for:
      hours: 0
      minutes: 5
      seconds: 0
    value_template: ""
    below: 5
condition: []
action:
  - type: turn_on
    device_id: 4d5f684cdc02130f17f6febc2d6c1611
    entity_id: switch.lds_zb_onoffplug_d0005_switch
    domain: switch
mode: single

Well I’ve had a couple of days with sunny spells and grid power at zero and the plug has not come on.
Aby ideas ?

Try to share the full automation, and also select the yaml and click at this icon “</>” right above the message box so it will look more friendly to everyone.

1 Like

Thanks. I’ve edited the original post.

I don’t see anything wrong with your automation, although you mentioned it will trigger bellow 1 but the automation is set to trigger bellow 5.

One important thing to understand is that the trigger is happening when the value drops from above 5 to bellow 5 and stays there for more than 5 minutes. If the power is already bellow 5 when you start the automation, it will never trigger unless it goes above 5 and then bellow 5 again.

Sorry my code was different from what I said in the original post as I have been messing around with it a lot :slight_smile: Anyhoo. I have been able to get it to work. I didn’t know my grid draw was in kW for starters, I was basing it on watts. I’ve also added an AND to make sure the humidity is above 54%.
Some of the things have taken me a while to figure out but it’s quite enjoyable.
Thanks for your help.

1 Like