Hi, I have two motion sensor (binary_sensor.motion_1 and _2) that I put together in a group group.motion_sensor_1_and_2
I would like that this group icon and behaviour should be as a motion sensor (the icon and icon behaviour when motion is triggered with a little man running and turning yellow), but I am not clear how to achieve this.
I need trhis behaviour:
this grouped binary sensor go ON when only one of the two motion sensor go ON
this grouped binary sensor go OFF when BOTH motion sensor go OFF
Logic is simple, if there is partly motion (only 1) for me is motion ON for the group; if there is no motion (both OFF) then the grouped motion is OFF
Did you end up finding a way to make such groups based on device_class?
I understand that the template binary sensor can act the same way but i’d like something more automated than adding multiple entities to that code.
Thanks in advance
They essensially get all sensors with a specific device class, in my case motion and opening and put them in a group. I also exclude some sensors i didnt want included.
Those two scripts run on my startup routine with this automation:
- alias: Startup Stuff - Notifications
id: cea3ed9689054b0dac9a73ac9fc63091
trigger:
- event: start
platform: homeassistant
action:
- data:
message: HomeAssistant is up
service: notify.mobile_app_sm_n975f
- alias: Create All Groups
entity_id: script.create_group_all_motion_sensors, script.create_group_all_opening_sensors
service: script.turn_on
Thank you for your suggestion. I used it and entered a third motion sensor. Once I entered the below code in the my configuration yaml, I used “binary_sensor.motion_group” as a trigger for my automation using the automation UI (Note, “Garage Group Motion” is the friendly name that pops up when searching the Entity for the trigger but once I click on it, the name defaults to “binary_sensor.motion_group” . This makes me wonder what will happen if I try to make another motion group; will its default name also be “binary_sensor.motion_group” but have a different friendly name? I just haven’t had a need for a second motion group yet. Thanks for the help!
Note: When I click the reply button, it gives me a" Unformatted Code Warning" even though I have the ``` before and after the below code… This is my first time posting code.
# For GARAGE motion detection
- platform: template
sensors:
motion_group:
friendly_name: Garage Group Motion
device_class: motion
value_template: "{{ is_state('binary_sensor.ewelink_ms01_76186722_ias_zone', 'on') or is_state('binary_sensor.ewelink_ms01_b1f16622_ias_zone', 'on') or is_state('binary_sensor.ewelink_ms01_89436822_ias_zone', 'on') }}"
- platform: template
sensors:
motion_group_1: # <- this name must be unique
friendly_name: Garage Group Motion
...
motion_group_2: # <- this name must be unique
friendly_name: Another Group Motion
...