#Send custom event from esphome and filter it using device id from blueprint selector
1 messages · Page 1 of 1 (latest)
Hi I think I'm trying to do the same thing. I'm creating a blueprint that is triggered by dahua_event_received, and toggles input_booleans for the different event types. I have an input selector that lets me pick a camera, but it returns a device ID, and need to turn that into the device name. I'm trying to user device_attr but I'm doing something wrong because HA refuses to import the blueprint. ```
variables:
camera_id: !input camera_name
triggers:
- trigger: event
event_type: dahua_event_received
event_data:
Code: !input motion_event
DeviceName: {{ device_attr( {{ camera_id }} ,"name") }}
action: Start
conditions: []while parsing a flow mapping in "<unicode string>", line 53, column 20: DeviceName: {{ device_attr( {{ camera_id }} , ... ^ expected ',' or '}', but got '{' in "<unicode string>", line 53, column 35: DeviceName: {{ device_attr( {{ camera_id }} ,"name") }} ^```
Rule #1 of templates... they must be surround by quotes or preceded by a multi-line quote indicator.
Don't nest templates, just use the variable on it's own:
DeviceName: "{{ device_attr(camera_id,'name') }}"