Hi, I am trying to create an automation that will toggle all the plugs in an area when a button is clicked.
This is the same behavior as the area toggle that gets automatically added to the dashboard, see:
So the desired behaviour is like this: if one of the plugs in the area is on, turn them off; if none of the plus in the area are on, turm all of them on.
I searched the documentation and the forum, but could not find a solution that works. I found some solutions that require to create a group, but I would like to avoid that if possible. I feel like I am missing something fairly obvious.
The following automation configuration toggles all the entities in the area individually, which is not what I want.
alias: Toggle Area
description: ''
trigger:
- platform: device
domain: mqtt
device_id: 45f06abed8227cc756974d0b655c2bfd
type: action
subtype: left_bottom_release
discovery_id: 0x000d6f000fe4c1d2 action_left_bottom_release
condition: []
action:
- service: homeassistant.toggle
target:
area_id: woonkamer_lampen
mode: single
See also this related topic (use-header-toggle-in-automation), but this is not specific about area’s.