icloud3_v3
icloud3_v3 copied to clipboard
Feature request: Dynamic notification group based on zone
It would be nice if we could have a dynamic (notification) group of all devices in a specific zone.
The purpose for this would be to be able to send a message to every device in zone XYZ. ("Washing machine is done", is only useful to people who are at home)
This can probably be done using automations and scripts with triggers and conditions and does not really apply to iCloud3. You can use the iCloud3 sensor.[devicename]_zone_name sensor to identify the zone someone is in.
That's exactly how I've done it. I use MSR for my rules engine and have exactly this in place. It holds the notifications until I'm back home, gives me first warning and then subsequent warnings until the lid is raised (meaning I've done the emptying.
Thank you both for your quick replies.
That is how I currently have it. But the only way I can get that working is by 'manually' going through each device, check whether or not it is 'Home' and send the notify-command. This of course works fine in practice, but I was looking for something cleaner.
A dynamic notification group would be much cleaner and easier to maintain.
I understand that you consider this (more or less) 'out of scope' for this integration, but I figured I'd ask anyway :)
Maybe there is some python script on JACS that will f do what you are looking for.
You can create dynamic groups with automations:
automation:
- alias: Create home group
trigger:
platform: homeassistant
event: start
action:
service: group.set
data_template:
object_id: devices_at_zone_home
entities: >-
{%-
for state in states.sensor
if state.entity_id.endswith("zone_fname") and state.attributes.zone == 'home'
%}
{{ state.entity_id}}
{%- endfor %}
You can also loop through the device trackers or whatever you want. And change the triggers to when you want to update the group:
automation:
- alias: Create home group
trigger:
platform: homeassistant
event: start
action:
service: group.set
data_template:
object_id: devices_at_zone_home
entities: >-
{%-
for state in states.device_tracker
if state.attributes.integration == "iCloud3" and state.attributes.zone == 'home'
%}
{{ state.entity_id }}
{%- endfor %}