Nick4
(Nick)
1
For the doorbell I was using a custom integration which is not developed anymore.
I have this trigger & condition in an automation:
triggers:
- trigger: event
event_type: dahua_vto
event_data:
Code: BackKeyLight
entity_id: sensor.dahua_vto
conditions:
- condition: template
value_template: "{{ trigger.event.data.Data.State | int in [1, 2] }}"
Is it possible to create a sensor from this?
I have tried in the UI and in yaml but cannot seem to get it right.
TIA
Hellis81
(Hellis81)
2
I would say you could use what you have in the example for triggered sensor ( 2nd example ):
And I guess the state could be something like {{ trigger.to_state.state}}
1 Like
Yes, but what exactly are you trying to do with the resulting sensor?
For example, if the goal is to have something to use as a trigger, you could do something like:
template:
- triggers:
- trigger: event
event_type: dahua_vto
event_data:
Code: BackKeyLight
entity_id: sensor.dahua_vto
conditions:
- condition: template
value_template: "{{ trigger.event.data.Data.State | int in [1, 2] }}"
sensor:
- name: Doorbell ring
state: "{{now()}}"
Then your automation would just trigger on any state change:
trigger: state
entity_id: sensor.doorbell_ring
not_to:
- unknown
- unavailable
1 Like
Nick4
(Nick)
4
Thanks guys for jumping in!
For a BP I need a sensor from the doorbell when pushed but I only have that event, which is general, therefor the condition.