Hi All,
I’m trying to configure my KERUI D026 door/window sensor to work with HA through rflink component.
Ultimately I need an entity that reflects window’s state - open/closed (on/off) so its state change could be picked up by alarm panel to react upon.
So far the easiest way was to create an input_boolean
switch:
input_boolean:
1st_floor_window_detector:
name: “1st floor window detector”
initial: off
icon: mdi:window-closed
make rflink fire event every time it receives a command from the sensor, and in automation that catches these events switch the 1st_floor_window_detector
accordingly.
However, I have two problems here.
- My sensor sends two different commands on
close
so I need to catch events from 3 different entities (one for open and 2 for close). I hoped that the followingtrigger
section will work, but it does not:- id: catch_1st_floor_window_detector_closed_event
hide_entity: true
trigger: - platform: event
event_type: button_pressed
event_data:
entity_id: switch.1st_floor_window_closed_detector_1, switch.1st_floor_window_closed_detector_2
- id: catch_1st_floor_window_detector_closed_event
I also tried this with the same result:
trigger:
- platform: event
event_type: button_pressed
event_data:
entity_id:
- switch.1st_floor_window_closed_detector_1
- switch.1st_floor_window_closed_detector_2
It just doesn’t match apparently as I can see no action performed.
But if I separate it into pieces it does work:
trigger:
- platform: event
event_type: button_pressed
event_data:
entity_id: switch.1st_floor_window_closed_detector_1
- platform: event
event_type: button_pressed
event_data:
entity_id: switch.1st_floor_window_closed_detector_2
The question is, is it possible to have multiple entity_id
at all?
- I want to turn my
input_boolean
on
when anopen
event arrives fromswitch.1st_floor_window_opened_detector
, andoff
when aclose
one does from eitherswitch.1st_floor_window_closed_detector_1
orswitch.1st_floor_window_closed_detector_2
.
I tried something like
service_template: >
{% if {{ trigger.event.data[‘entity_id’] == switch.1st_floor_window_opened_detector }} %}
input_boolean.turn_on
{% else %}
input_boolean.turn_off
{% endif %}
entity_id: input_boolean.1st_floor_window_detector
but it didn’t work, apparently a comparison should be done differently.
Could not find the right way to do that, any ideas how to put it right?
And any suggestion in general to my approach are much appreciated as I’m new to all this Python/HA/rflink stuff and haven’t got the whole picture of things yet
Update: solved the 2nd problem:
service_template: >
{% if trigger.event.data[‘entity_id’] == ‘switch.1st_floor_window_opened_detector’ %}
input_boolean.turn_on
{% else %}
input_boolean.turn_off
{% endif %}
entity_id: input_boolean.1st_floor_window_detector