I am trying to build a Template Sensor for my DoorBird Doorbell. But I am not sure how to use the Template with a event. In the DoorBird docs is just an exempel for Automations. https://www.home-assistant.io/components/doorbird/
An event is a transient thing. It happens, but there’s no persistence to it. (I.e., it doesn’t, itself, record anything in the state machine.) You can use it to trigger an automation, that’s about it. If you want to have something that shows that the event happened, then you could use an automation (triggered by the event) to create some sort of notification, or possibly change an input_boolean. It depends on what you want to do or see when the event happens. If you could elaborate on what you’d like to see or happen when the event occurs, I’d be happy to help further.
One possible use case is to use the event to turn an input_boolean on, which you can see in the frontend. Then you can click on it to turn it off. E.g.:
For those interested, I made it with a template BINARY sensor, and an input boolean. An automation catches the event from Doorbird and sets the input boolean to on (initial is off), then a delay of 5 seconds, then sets it back to off. The template binary sensor (type: motion) is linked to the input boolean value.
And it works. Would be great to have it by default in the Doorbird integration, IMHO.
Hi @itssam,
I will assume you have set up, in your config and in the Doorbird app, the event for motion as described in the documentation, obvious prerequisite.
First, the code for an input boolean (could be a variable if you have this HACS integration).
input_boolean:
doorbird_motion:
name: Doorbird mouvement
initial: off
icon: mdi:motion-sensor #for fun, because this control is not necessary in the UI
Then, the template binary sensor (to use in your UI and automations):
For those who, like me, come across this thread to implement the motion sensor and bell events in HA, here are two tips that took me a few hours of trial and error:
The documentation explains how the http-call arrives in HA. I have overlooked several times that doorbird_ must be placed before the device name. Example:
Device name in the HA integration: Doorbird Eingang
Event name in the configuration options of the device in HA: Bewegung
Event type in Automation: doorbird_doorbird_eingang_Bewegung