I have had these binary sensors for quite some time and they worked fine. I was collecting the data for these entities every 5 minutes. I am now able to collect it every 45 seconds. This has led to these sensors triggering a lot more often when we export or import from the grid for a short period of time. I added the delay_on.
Am I using this right? The sensor will not trigger an on state unless we export or import for 2 minutes, but it will trigger an off state straight away?
Just in case it helps others. Mine looks like this. If the sun comes out later and I start to export, I will show what it looks like when one triggers.
Tracking the sensor history has been helpful. My automation to notify me I was exported triggered, but they notification to say I am no long exporting did not.
I can it did wait 2 minutes to trigger the status is off, but off never triggered the notification
I think it is working. It looks like it is working. I think the example above was just bad luck. It seemed to trigger after 2 minutes and it then immediately went off.
alias: Grid - Exporting To The Grid Status
description: Grid - Exporting To The Grid Status
trigger:
- platform: state
entity_id: binary_sensor.binary_exporting_to_grid
condition:
- condition: time
after: "07:00:00"
before: "21:00:00"
action:
- service: notify.notify
data:
message: |
{% if trigger.to_state.state == 'off' %}
No longer exporting
at {{ now().strftime('%H:%M') }}
{% else %}
Exporting {{ states("sensor.lux_power_to_grid_live") }} watts to the grid
at {{ now().strftime('%H:%M') }}
{% endif %}
title: Exporting Status
mode: single