Bought a couple of Xiaomi “Smart Buttons” and set one up as a doorbell. I was dismayed to see a lot of bounce in the deconz_event. This is from a single push:
Event 11 fired 3:51 PM:
{
"event_type": "deconz_event",
"data": {
"id": "doorbell",
"unique_id": "00:15:8d:00:03:d1:2f:92",
"event": 1002
},
"origin": "LOCAL",
"time_fired": "2020-07-21T21:51:00.270602+00:00",
"context": {
"id": "3534bdeaca934520ada5445ae400e7b3",
"parent_id": null,
"user_id": null
}
}
Event 10 fired 3:50 PM:
{
"event_type": "deconz_event",
"data": {
"id": "doorbell",
"unique_id": "00:15:8d:00:03:d1:2f:92",
"event": 1002
},
"origin": "LOCAL",
"time_fired": "2020-07-21T21:50:59.957558+00:00",
"context": {
"id": "9857c824fc94458787b01b332e5729cb",
"parent_id": null,
"user_id": null
}
}
Event 9 fired 3:50 PM:
{
"event_type": "deconz_event",
"data": {
"id": "doorbell",
"unique_id": "00:15:8d:00:03:d1:2f:92",
"event": 1002
},
"origin": "LOCAL",
"time_fired": "2020-07-21T21:50:59.782736+00:00",
"context": {
"id": "443513d2e7504b418f38fa7e44786757",
"parent_id": null,
"user_id": null
}
}
Event 8 fired 3:50 PM:
{
"event_type": "deconz_event",
"data": {
"id": "doorbell",
"unique_id": "00:15:8d:00:03:d1:2f:92",
"event": 1002
},
"origin": "LOCAL",
"time_fired": "2020-07-21T21:50:59.690406+00:00",
"context": {
"id": "701f404330dc41e3836c011fa7589c1c",
"parent_id": null,
"user_id": null
}
}
Event 7 fired 3:50 PM:
{
"event_type": "deconz_event",
"data": {
"id": "doorbell",
"unique_id": "00:15:8d:00:03:d1:2f:92",
"event": 1002
},
"origin": "LOCAL",
"time_fired": "2020-07-21T21:50:59.604313+00:00",
"context": {
"id": "db01d0e9679f40498c0a00b0ebb0c461",
"parent_id": null,
"user_id": null
}
}
Event 6 fired 3:50 PM:
{
"event_type": "deconz_event",
"data": {
"id": "doorbell",
"unique_id": "00:15:8d:00:03:d1:2f:92",
"event": 1002
},
"origin": "LOCAL",
"time_fired": "2020-07-21T21:50:59.534033+00:00",
"context": {
"id": "cf8f2537d43a4cabbe3cce338b5e6f54",
"parent_id": null,
"user_id": null
}
}
Event 5 fired 3:50 PM:
{
"event_type": "deconz_event",
"data": {
"id": "doorbell",
"unique_id": "00:15:8d:00:03:d1:2f:92",
"event": 1000
},
"origin": "LOCAL",
"time_fired": "2020-07-21T21:50:59.309157+00:00",
"context": {
"id": "a27f0bc5a2ac4ce996de9c9a9756969d",
"parent_id": null,
"user_id": null
}
}
Event 4 fired 3:50 PM:
{
"event_type": "deconz_event",
"data": {
"id": "doorbell",
"unique_id": "00:15:8d:00:03:d1:2f:92",
"event": 1000
},
"origin": "LOCAL",
"time_fired": "2020-07-21T21:50:59.004673+00:00",
"context": {
"id": "3d6ed16c04584dd38258fa72d58598d0",
"parent_id": null,
"user_id": null
}
}
Event 3 fired 3:50 PM:
{
"event_type": "deconz_event",
"data": {
"id": "doorbell",
"unique_id": "00:15:8d:00:03:d1:2f:92",
"event": 1000
},
"origin": "LOCAL",
"time_fired": "2020-07-21T21:50:58.827467+00:00",
"context": {
"id": "91a3cae3edc94c64812842cb8dc5427a",
"parent_id": null,
"user_id": null
}
}
Event 2 fired 3:50 PM:
{
"event_type": "deconz_event",
"data": {
"id": "doorbell",
"unique_id": "00:15:8d:00:03:d1:2f:92",
"event": 1000
},
"origin": "LOCAL",
"time_fired": "2020-07-21T21:50:58.714548+00:00",
"context": {
"id": "2817bce2a94e4113854f8f81cc075c1f",
"parent_id": null,
"user_id": null
}
}
Event 1 fired 3:50 PM:
{
"event_type": "deconz_event",
"data": {
"id": "doorbell",
"unique_id": "00:15:8d:00:03:d1:2f:92",
"event": 1000
},
"origin": "LOCAL",
"time_fired": "2020-07-21T21:50:58.646148+00:00",
"context": {
"id": "57fb3b3960134cb180f385d29fa23f36",
"parent_id": null,
"user_id": null
}
}
Event 0 fired 3:50 PM:
{
"event_type": "deconz_event",
"data": {
"id": "doorbell",
"unique_id": "00:15:8d:00:03:d1:2f:92",
"event": 1000
},
"origin": "LOCAL",
"time_fired": "2020-07-21T21:50:58.584742+00:00",
"context": {
"id": "2c46158689e841299c6f0f84f43448a1",
"parent_id": null,
"user_id": null
}
}
1000 is the push in and 1002 is the release. It is reporting 6 ins and outs with a single push. So what I eventually ended up doing was setting up an input_boolean to filter them and then used that to trigger the doorbell notification. I also limited the ring to one every three seconds, so if someone goes crazy on your doorbell, your automation limits how crazy they can be.
input_boolean:
doorbell:
name: "Doorbell"
automation:
- alias: Pushbutton Doorbell In
trigger:
platform: event
event_type: deconz_event
event_data:
id: doorbell
unique_id: 00:15:8d:00:03:d1:2f:92
condition:
condition: template
value_template: >
{% set valid_events = [1000, 1003, 1004, 1005] %}
{{ trigger.event.data.event in valid_events }}
action:
- service: input_boolean.turn_on
entity_id: input_boolean.doorbell
- alias: Pushbutton Doorbell Ring
trigger:
platform: state
entity_id: input_boolean.doorbell
to: 'on'
action:
- service: notify.mobile_app_iphone
data:
message: "Doorbell 🔔"
data:
push:
sound:
name: Sherwood_Forest.caf
- alias: Pushbutton Doorbell Clear
trigger:
platform: state
entity_id: input_boolean.doorbell
to: 'on'
for:
seconds: 3
action:
- service: input_boolean.turn_off
entity_id: input_boolean.doorbell