Quantcast
Channel: Configuration - Home Assistant Community
Viewing all articles
Browse latest Browse all 106772

Automation using not_home state

$
0
0

Morning all, I just updated my HomeAssistant from an old version to the last one.
To move all automations I moved manually all files from a backup on the Hassio folder, through SFTP.

With the old HA version, my automations worked properly, now not.
Pseudo code:
Automation 1: if me AND my wife leave home, turn on a smart plug:

- id: '222'
  alias: Turn ON smartPlug when last family member leaves home
  description: Turn ON smartPlug when last family member leaves home
  trigger:
  - platform: state
    entity_id:
    - device_tracker.life360_me
    to: not_home
  - platform: state
    entity_id:
    - device_tracker.life360_wife
    to: not_home
  condition:
  - condition: device
    type: is_off
    device_id: 382a0c5296e5bb61800dbf8198b921a2
    entity_id: switch.smartPlug
    domain: switch
  - condition: and
    conditions:
    - condition: state
      entity_id: device_tracker.life360_me
      state: not_home
  - condition: and
    conditions:
    - condition: state
      entity_id: device_tracker.life360_wife
      state: not_home
  action:
  - type: turn_on
    device_id: 382a0c5296e5bb61800dbf8198b921a2
    entity_id: switch.smartPlug
    domain: switch
  - service: notify.mobile_app_iphone_di_me
    data:
      message: Turn ON smartPlug when last family member leaves home
  mode: single

Automation 1: if me OR my wife get home, turn OFF a smart plug:

- id: '111'
  alias: Turn off smartPlug when first family member gets home
  description: Turn off smartPlug when first family member gets home
  trigger:
  - platform: state
    entity_id: device_tracker.life360_wife
    to: home
  - platform: state
    entity_id: device_tracker.life360_me
    to: home
  condition:
  - condition: device
    type: is_on
    device_id: 382a0c5296e5bb61800dbf8198b921a2
    entity_id: switch.smartPlug
    domain: switch
  action:
  - type: turn_off
    device_id: 382a0c5296e5bb61800dbf8198b921a2
    entity_id: switch.smartPlug
    domain: switch
  - service: notify.mobile_app_iphone_di_me
    data:
      message: Turn off smartPlug when first family member gets home
  mode: single

Could you please tell me how I can test it? should I we have to leave home to test it?

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 106772

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>