IqNotify – smart notification grouping: only home, only away, just left etc

Hi, I’ve made a custom_component to take control over notifications I’m sending to mobile devices.

How can you notify?

  • Notify only people present at home. (only_home)
  • Notify only people away from home. (only_away)
  • Notify people that just arrived home. (just_arrived)
  • Notify people that just left home. (just_left)
  • Notify people that are present at home for particular time. (staying_home)
  • Notify people that are away from home for particular time. (staying_away)
  • Try to notify people at home, but if none – notify people away. (only_home_then_away)

How it works

Just like group notify platform it combines multiple notification services with presence detection entities:

  - platform: iq_notify
    name: iphones
      - entity: binary_sensor.presence_he
        service: his_iphone
      - entity: binary_sensor.presence_she
        service: her_iphone

Will create new service called notify.iphones you can use for regular automations.

Configuration reference

  - platform: iq_notify # the platform to use
    name: iphones       # alias name for notify.{name}
    time: 2             # time offset in which we assume someone "just left/arrived" or "is staying"
    pairs:              # a list of presence entities are corresponding notify services
      - entity: binary_sensor.presence_he  # presence entity id #1
        service: his_iphone                # notify service to use for above entity, without domain (notify.)
      - entity: binary_sensor.presence_she # presence entity id #2
        service: her_iphone                # notify service to use for above entity, without domain (notify.)

time (defaults to 2)
In minutes as offset to analyze if someone “just left/arrived”. If someone will be at given state longer than given time – he/she won’t be considered as someone that “just …”. This is also used for “staying home/away”. Someone must be minimum of time in given state to be considered as “staying …”.

entity (required)
ID of any entity that state for “present” is on or home and off or not_home for “away”.
Can be input_boolean, binary_sensor , group, switch, device_tracker etc.

service (required)
Is a service to use for notification without notify. domain.

Example automations

Send notification only to people that are present at home.
- alias: 'Notify: on garbage disposal'
    platform: state
    entity_id: calendar.garbage_disposal
    to: 'on'
    condition: state
    entity_id: binary_sensor.people_present
    state: 'on'
    - service: notify.iphones
        title: Garbage disposal
        message: "{{ states.calendar.garbage_disposal.attributes.message }}"
          mode: only_home

If there is someone present – notify people that are present that today is the day of garbage disposal. We don’t want to notify people that are away, because they wouldn’t take the garbage out in front of the house.

Send notification to last person who just left home and this way armed the alarm.

- alias: 'Alarm: arm away when everyone left'
    platform: state
    entity_id: binary_sensor.people_present
    to: 'off'
    - service: alarm_control_panel.alarm_arm_away
      entity_id: alarm_control_panel.alarm

- alias: 'Alarm: send notification on arming'
    - platform: state
      entity_id: alarm_control_panel.alarm
      to: 'armed_away'
    - service: notify.iphones
        title: Alarm
        message: Alarm has been armed.
          mode: just_left

First automation tracks if everyone left home. If so – arms the alarm. After alarm is armed – second notification notifies only the person who “just left” that the alarm was armed successfully. The last person is responsible for arming the alarm.

Notify only people that are home, but if there are none – notify those away.

- alias: 'Door: remind on garage door kept opened'
    platform: state
    entity_id: binary_sensor.garage_door_contact
    to: 'on'
    for: '00:05:00'
    - service: notify.iphones
        title: Garage door
        message: Garage door kept opened for 5mins.
          mode: only_home_then_away

Will let know inmates that are home about the door that are not closed, but should be. They are home so they can close it. Otherwise if no one is home – let everyone know, because it might be a security breach.


You can get the component here:

How to install
  1. Clone repository into $HASS_HOME/custom_components/iq_notify.
  2. Update your configuration.yaml.


This platform is not yet 100% tested. Any suggestions and issue reports are welcome!


Hey @Seweryn_Zeman, I’m really diggin’ this component! It’s made life easier for sure. I was wondering if there was a way to add the ability to filter out people who are “out of town”? My whole household travels for work and I’d rather not bug anyone who might be out of town with notifications about the house (unless everyone is out of town). I’ve got the proximity component set up for each of us and was thinking of just making the condition “<100 miles from home”. I’ve looked at your code but I have very little knowledge in that department so I would just break it, I’m sure. I really hope this can work and I look forward to hopefully hearing back from you! Thanks again for making this component!

Hi @dmo012,
You can use any entity that has state on/off or home/away. Proximity gives you state as distance (in km). If you have your condition “<100mi from home” you can simply create an template sensor:

  - platform: template
        friendly_name: "He's in town"
        value_template: >-
          {{ states('proximity.he')|float < 160 }} # 160km = ~100mi

Then simply:

  - platform: iq_notify
      - entity: binary_sensor.he_in_town
        service: his_iphone    

I see. But wouldn’t this just make it think that entity is home when it’s <100 miles from home? Or will it ignore it completely when it’s >100 miles?

Great component! Thanks!
Question: Does it accept zones as away, so that we can use the person-entity for presence detection? Eg. home/school/work/away.

It currently works only with home/away, but I think you could use it with zones with states “zoning” and… the other one. I can’t remember… If you verify the states I can change it a little bit if it fits you.

Yes, confirm every zone has the state “zoning”:

`zoning` is the state a `zone` has when it is configured. A `zone` doesn’t have another state; all configured zones are `zoning` all the time.

How about AWAY = !HOME ? So that regardless of zones, it detects AWAY if not HOME.