Notifications based on presence in wifi?

I want to create a “washing machine finished” automation. When finished, I want to send notifications if:

  • nobody is at home: to all persons
  • otherwise only to persons logged into the home wifi

As long as the washing machine has not been opened (this could be a binary sensor detecting 0 W power), I want to repeat the notifications every X minutes.

Question: should I use nodered for those cases (I have no experience in nodered)? Or is that possible directly in HA? If yes, how could I automate this rather complex cenario??

This is a pretty simple alert that you could do without node red.

Create a binary template sensor that is on when your conditions are true. Use it to trigger an alert:

Ok nice, but how can I send a notification conditionally only if a person is “presence detected”? Could you give an example?

You base your Binary Sensor template on that.

Give me the entity ids you want to use and the logic and I can help you with the template.

This automation triggers if power level drops below threshold:

- id: '12345678'
  alias: Dishwasher finished
  trigger:
  - below: '3.1'
    entity_id: sensor.dishwasher_energy_power
    platform: numeric_state
condition: []
  action:
  - data:
      message: Washing machine finished
    service: notify.mobile_app_membersound

Now I want to add conditional notification:
-notify mobile_app_membersound and mobile_app_wife if both are at home
-notify mobile_app_membersound if only I’m at home
-notify mobile_app_wife if only my wife at home
-notify also both of nobody is at home

Preferably, I would not want to repeat this logic in each automation. Because I want to send “finished” notifications also for other devices like washing machine, dryer, etc. Same presence logic.

The best way to do that would be a script that you pass the message to. It runs the logic of where to send it. That way you can use the script in many automations.

However, initially you said you wanted to repeat these notifications until something occurs. Is this still the case?

I’m trying step by step. First goal is to achieve the the presence-based notifications.
Could you give an example of a “script where I can pass the message to”?

But yes, lateron I’d want to repeat the notifications let’s say every 5 minutes as long as the power did not drop to 0W (means still idle).

This exact scenario is shown in the documents: Scripts - Home Assistant

Great, that’s probably what I was looking for. So to say, like programming functions with parameters.

Still I don’t understand how I could add routes for notifications based on presence?

script:
  notify_family:
    fields:
      title
      message
    sequence:
      - condition: state
        entity_id: device_tracker.membersound
        state: 'home'
      - service: notify.mobile_app_membersound
        data_template:
          title: "{{ title }}"
          message: "{{ message }}"

Even if I’d create multiple binary sensors telling me if everyone, nobody, or only some people are at home. How can I then switch to different notify.* calls? Eg notify.all or notify.mobile_app_membersound?

Ok, you’ve got the script to send a message now we just need to add a service template to decide who to deliver it to. I don’t know your exact tracker or notify entity ids but you should be able to edit this:

script:
  notify_family:
    fields:
      title
      message
   sequence:
      - service_template: >
          {% if states('tracker.person_1', 'home') and states('tracker.person_2', 'home') %}
             notify.mobile_person_1_and_2
          {% elif states('tracker.person_1', 'home') %}
             notify.mobile_person_1
          {% elif states('tracker.person_2', 'home') %}
             notify.mobile_person_2
          {% else %}
             notify.mobile_person_1_and_2
          {% endif %}
        data_template:
          title: "{{ title }}"
          message: "{{ message }}"
1 Like