Only notifications in the room with presence

I have speakers in every room of the house.
When particular events occur some notifications are read from the kitchen speaker.
Instead, I would like only the speaker of the room you are in to work. the simplest solution for me is to generate the same automation for each room “and if” the presence sensor detects the presence read the notification on the speaker in that room. Is it possible to run just one automation to accomplish this?

A single automation that reproduces the notification where it finds the presence?

Thank you

It is most certainly possible and there are probably several ways to do it.

I think you need to post some examples of your code so that people have enough to work with to give you suggestiosn about possible approaches.

1 Like

As a maintainer of such setup I could say that it is possible but that doesn’t mean that it is the most handy solution. Multiple automations tailored for each room is much easier to maintain and to debug. There is really no need to have everything in one big automation.

You would need to:

Create something that isolates yojr rooms and denotes occupancy.

Then based on that, dynamically maintain a template sensor that has a list of notify targets.

Then just fire notify to that list when you need to

These are very simple automations… like “if the doorbell rings” then “play audio file” on the kitchen speaker.

All that needs to be added is… “play audio file” on the speaker of the room where there is presence.

I’ve been using Home Assistant for a short time and sometimes I notice that there are simpler shortcuts to manage automations and actions.

If it’s that simple, why are you posting? If you expect people to help you, you should be willing to answer their questions.

I finally found the solution to my situation and it was much easier than I thought…

in “action” just select “choose” and than you can select different “Options” with different “condition” and “action” to do.

you have to choose a “choice” for each of the devices you want to give the condition

This is an example of my automation:

if a condition has occurred:

THAN:

choose:
  - conditions:
      - type: is_occupied
        condition: device
        device_id: 4a843b8aecbfb045e0db1b4bb7f712a1
        entity_id: eedfa2d99bd61324fbb987e919e0af9d
        domain: binary_sensor
    sequence:
      - action: chime_tts.say
        metadata: {}
        data:
          message: Prova 1
          chime_path: bells
          volume_level: 0.5
        target:
          device_id: ed6871f4acfbc363a719cc0f963d9714

the code above will play audio ONLY if it detects presence in that room

Than create another “choice”:

choose:
  - conditions:
      - type: is_occupied
        condition: device
        device_id: e51ee2fb6aadfa78c81de4f2b0eeace6
        entity_id: fdf51df1fa1053e3c9311d11a73fac1e
        domain: binary_sensor
    sequence:
      - action: chime_tts.say
        metadata: {}
        data:
          chime_path: bells
          message: Prova 2
        target:
          device_id: 28bd9fcbadc240a216a38e94c7b539d1

and the code above will play the message only in the indicated room ONLY if it detects motion in that specific room.

If none of the sensors detect movement in any room, of course nothing will be played.

I hope I can be of help to someone without wasting hours of tests and research.
And above all I hope I was clear in the description…