Receiving duplicate notifications

i set up an automation to notify when the back door opens. it works BUT it also notifies whenever door closes. how to prevent this because i only need to know when it is open.
in my automation.yaml, i have:

- id: '1558836134896'
  alias: alert back door open
  trigger:
  - entity_id: binary_sensor.back_door
    from: 'off'
    platform: state
    to: 'on'
  condition: []
  action:
  - data:
      message: back door open
    service: notify.notifier

What does your binary sensor look like?

Maybe you need to ensure the state of the back door is in fact off, and leave the from: off out of the trigger.

- alias: Back Door Open
  trigger:
    platform: state
    to: 'on'
  condition:
    condition: template
    value_template:  '{{ is_state('binary_sensor.back_door','off') }}
  action:
    service: notify.notifier
    data:
      message: "Back door open"

How does binary_sensor.back_door get its value? Is it possible it’s not de-bounced properly?

my back door gets data from envisalink and works really well https://www.home-assistant.io/components/envisalink/

in dev-state, i see it as on or off:
binary_sensor.back_door

The only way that automation will trigger is if binary_sensor.back_door goes from off (closed) to on (open.) If it’s triggering when the back door closes, then it’s because the state of that sensor went from on (open), to off (closed), to on (open, which would trigger the automation), to off (closed.)

Are you sure it’s this automation that is causing the notification when the door closes? Have you checked the Logbook and/or home-assistant.log (maybe enable debug)?

1 Like

let me try your code now. i see the problem is only when i close the door within 5 minutes (this also happens with the front door too)! so if i close the door after 1 hour, i definitely dont get the message alert “Back door open”

So, is the state of the door timing out and switching back to the off position while the door is open, and then re-triggering when the door closes?

Actually, I’ve got a similar problem. DSC 1832 with Envisalink 4. You open and close a door and the sensor changes from “closed” to “open” properly. But then, there is a /phantom/ door opening which follows where HA shows the door opens (is open for 30s) and then closes. However, at the same time, the DSC keypad shows that the system is ready (green check) so presumably the DSC knows the door is closed at that time.

# Configuration (shortened to just include a few sensors which all exhibit this behavior)
envisalink:
  host: 192.X.Y.Z
  panel_type: DSC
  user_name: <redacted>
  password: <redacted>
  evl_version: 4
  keepalive_interval: 60
  timeout: 10
  panic_type: Police
  zones:
    1:
      name: "Front Entry"
      type: "door"
    2:
      name: "Garage Entry"
      type: "door"
    3:
      name: "Side Entry"
      type: "door"
  partitions:
    1:
      name: "Security System"

I setup syslog and it looks like the Envisalink is correctly seeing only one open/close event:

2021-04-05T11:38:50.407176-05:00 envisalink ENVISALINK[XXX]:  Zone Open: 2
2021-04-05T11:38:57.429264-05:00 envisalink ENVISALINK[XXX]:  Zone Closed: 2
2021-04-05T11:39:10.469875-05:00 envisalink ENVISALINK[XXX]:  Zone Open: 3
2021-04-05T11:39:15.485182-05:00 envisalink ENVISALINK[XXX]:  Zone Closed: 3

yes. dsc and envisalink has no issues.
for whatever reason, HA is sending me these phantom/duplicate alerts. so what’s the solution?
i think @pnbruckner posted a solution but that has been removed or someone did. unfortunately, wehn i had to rebuild my HA, the solution was not found anymore

Well, maybe I just solved it. (1) since DSC doesn’t need the “zonedump_interval” AND (2) my phantom events always seem to last 30s (the “zonedump_interval” default), I just tried adding the following to my config and maybe it has fixed it?! I did a trial run and seems OK. Will test some more.

  zonedump_interval: 0

Well, over the last few hours, I haven’t seen any duplicates, since adding the configuration about the “zonedump_interval” as per my previous post.

where did you put your zonedump? which line? ok. nevermind, i see it. thanks! trying it now

Like so …

# Configuration (edited from above to include "zonedump_interval: 0")
envisalink:
  host: 192.X.Y.Z
  panel_type: DSC
  user_name: <redacted>
  password: <redacted>
  evl_version: 4
  keepalive_interval: 60
  zonedump_interval: 0
  timeout: 10
  panic_type: Police
  zones:
    1:
      name: "Front Entry"
      type: "door"
    2:
      name: "Garage Entry"
      type: "door"
    3:
      name: "Side Entry"
      type: "door"
  partitions:
    1:
      name: "Security System"

I can confirm that I’ve seen these “phantom” zone changes and that disabling zone dump fixes it. It much more of an issue if you happen to be using DSCSERVER as a proxy. For those that use that that app - as I do - I have not found anyway to find the current states of the zone after a reboot. But what does work well is if a zone opens or closes - that info does get picked up correctly. But as I mention if you reboot any open zones will show closed afterwards. Enabling zone dump will not fix it - and will break it from seeing zones that go open after reboot…the important thing to know is that if you are connected to the DSCSERVER or to the envilink - as long as you disable zonedump you will see the zone changes in real time.

Can you help with this. I think same issue. I have little experience here but wrote an automation where Alexa says door open when the from door is opened. This works. But when it’s closed Alexa says closed then about 30 seconds later days opened and then closed yet again.
Any suggestions.? Thanks

platform: state
entity_id:
binary_sensor.front_door
from: “on”
to: “off”
condition: []
action:
service: notify.alexa_media_echo_dot_ver_4
data:
message: The Front Door was just Closed
title: Front Door Closed
data:
type: tts
stop: “”
mode: single