I have 2 motion sensors connected to esp8266 I want to combine 2 into one.
By working to detect both movements, it is on to detect it as a movement.
How to write a template?
If I write it as a template, will it be correct to see that template is another motion sensor?
Are you using ESPHome?
Do you want to do this in ESPHome?
Or do you want both sensors visible in home assistant as well?
If the latter you can use a group:
Am I writing this right?
Yes but no.
I could show you exactly where if you had pasted correctly formatted text instead of a picture of text (please don’t do that again).
Your second group looks ok. The first one however is not indented correctly, has capital letters in the slug and has options that are no longer valid. Delete the view: no
line, change Garage Door:
to garage_door:
and indent it correctly like the group below it.
How to use groups?
I can’t find the name in Developer Tools.
More pictures of text. Really?
What did I say?
You called your group binary_sensor
so the group will be group.binary_sensor
.
This is not a good name for a group. I suggest you change it to something like movement_sensors:
In your configuration.yaml
, make sure you have-
group: !include groups.yaml
Next, in your groups.yaml
file, add this line-
dual_led_drawing_room:
name: Dual Led Drawing Room
all: true
entities:
- binary_sensor.mts_led_drawingroom_d2
- binary_sensor.mts_led_drawingroom_d2
By adding all: true
, the group state will be on
only if both entities in the group are on
.
Next, Check Configuration → Reload Group Entities OR Restart Home Assistant (only if you don’t see reload group entities option) → Go to Developer Tools → States (tab) → Type group.dual_led_drawing_room
to check if the group has been created successfully.
What if I want both motion sensors off?
value comes off
how to write
now i see it
What if I want both motion sensors off?
value comes off
how to write
dual_led_drawing_room:
name: Dual Led Drawing Room
all: true
entities:
- binary_sensor.mts_led_drawingroom_d2
- binary_sensor.mts_led_drawingroom_d2
Using the above code, the group state will only be on
if both binary_sensor.mts_led_drawingroom_d2
and binary_sensor.mts_led_drawingroom_d2
are on
.
If you remove all: true
, the group state will be on
with a requirement of at least one of the entities inside the group is on
.
What if I want both motion sensors off?
value comes off
how to write
Is it the same for both ‘on’ ?
In both cases, it is the same. With both sensors off the group will be off.
all: false
Sens 1 | Sens 2 | Group |
---|---|---|
Off | Off | Off |
Off | On | On |
On | Off | On |
On | On | On |
all: true
Sens 1 | Sens 2 | Group |
---|---|---|
Off | Off | Off |
Off | On | Off |
On | Off | Off |
On | On | On |
can i write like this
No.
Why would you?