Entity for when both my wife & my devices are not home (away)

Hi HA community,

I am trying to get some of my automations into Node-red.
One is to auto set alarm (Alarmo) to arm away when both my wife and my device is detected being 'not_home".
I have this working today in HA automations, but in Node-red i have the device item to use, but cannot seem to do wife_mobile & …

Should I create a group and put both devices in a group and then have HA mark group as “not_home” when both are away? Or should I be looking at creating a manual entity to that would allow Node-red to use this way.

Current automation in yaml which I want to move into Node-red is:

alias: Auto Arm Alarm when not home
description: ''
trigger:
  - platform: device
    device_id: <removed>
    domain: device_tracker
    entity_id: device_tracker.sm_g975f
    type: leaves
    zone: zone.home
    id: '1704'
  - platform: device
    device_id: <removed>
    domain: device_tracker
    entity_id: device_tracker.jess_s21
    type: leaves
    zone: zone.home
    id: '2105'
condition:
  - condition: device
    device_id: <removed>
    domain: device_tracker
    entity_id: device_tracker.sm_g975f
    type: is_not_home
  - condition: and
    conditions:
      - condition: device
        device_id: <removed>
        domain: device_tracker
        entity_id: device_tracker.jess_s21
        type: is_not_home
      - condition: and
        conditions:
          - condition: device
            device_id: >removed>
            domain: alarm_control_panel
            entity_id: alarm_control_panel.alarmo
            type: is_disarmed
  - condition: time
    after: '08:00:00'
    before: '19:00:00'
action:
  - service: alarm_control_panel.alarm_arm_away
    target:
      device_id: <removed>
      entity_id: alarm_control_panel.alarmo
  - service: notify.mobile_app_jess_s21
    data:
      message: Alarm is ARMED due to both Matt & Jess being away from Home
      title: Alarm ARMED Automatically - Both Away
  - service: notify.mobile_app_sm_g975f
    data:
      title: Alarm ARMED Automatically - Both Away
      message: Alarm is ARMED due to both Matt & Jess being away from Home
mode: single

Appreciate any insights.

Thank you.

ok,
keep researching and implemented this:

pretty simple.
I can now have a state changes node in node-red to continue with the flow I am after.

Will close.

[{"id":"aebbb038.44cef","type":"trigger-state","z":"ebd7f2e4.a2afc","name":"both away?","server":"9405c3fe.d0a6c","version":1,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityid":"device_tracker.sm_g975f, device_tracker.jess_s21","entityidfiltertype":"substring","debugenabled":false,"constraints":[{"targetType":"entity_id","targetValue":"device_tracker.jess_s21","propertyType":"current_state","comparatorType":"is","comparatorValueDatatype":"str","comparatorValue":"not_home","propertyValue":"new_state.state"},{"targetType":"entity_id","targetValue":"device_tracker.sm_g975f","propertyType":"current_state","comparatorType":"is","comparatorValueDatatype":"str","comparatorValue":"not_home","propertyValue":"new_state.state"}],"inputs":0,"outputs":2,"customoutputs":[],"outputinitially":false,"state_type":"str","enableInput":false,"x":730,"y":260,"wires":[["fadae510.eec768"],["110af1a5.bab87e"]]},{"id":"fadae510.eec768","type":"api-call-service","z":"ebd7f2e4.a2afc","name":"arm","server":"9405c3fe.d0a6c","version":3,"debugenabled":false,"service_domain":"","service":"","entityId":"","data":"","dataType":"jsonata","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":910,"y":240,"wires":[[]]},{"id":"110af1a5.bab87e","type":"api-call-service","z":"ebd7f2e4.a2afc","name":"disarm","server":"9405c3fe.d0a6c","version":3,"debugenabled":false,"service_domain":"","service":"","entityId":"","data":"","dataType":"jsonata","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":910,"y":280,"wires":[[]]},{"id":"9405c3fe.d0a6c","type":"server","name":"Home Assistant","version":2,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":false,"heartbeatInterval":30}]
1 Like

Hi, what type of group did you created?
I cannot find any group option in the UI that allows me to select a device_tracker entity.

Thanks

This might help:

Hi @kdober,

In my config file, I added the following to create a group:

group:
  jess_matt_location_group:
    name: "Matt and Jess Location Group"
    entities:
      - device_tracker.jess_pixel_7_pro
      - device_tracker.matts_pixel_7_pro

Unsure if there is a better/different way via UI now, but this works for me.

Hope this helps.

1 Like