icloud3_v3 icon indicating copy to clipboard operation
icloud3_v3 copied to clipboard

Feature request: Dynamic notification group based on zone

Open lenwar opened this issue 1 year ago • 6 comments

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)

lenwar avatar Jun 13 '23 13:06 lenwar

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.

gcobb321 avatar Jun 13 '23 17:06 gcobb321

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.

JtwoA avatar Jun 13 '23 17:06 JtwoA

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 :)

lenwar avatar Jun 13 '23 18:06 lenwar

Maybe there is some python script on JACS that will f do what you are looking for.

gcobb321 avatar Jun 13 '23 21:06 gcobb321

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 %}

woopstar avatar Oct 18 '23 14:10 woopstar

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 %}

woopstar avatar Oct 18 '23 14:10 woopstar