Automation with zone area,phone device and door sensor

Hi
I try to create some automation

if the phone device not at the area ( home)
and
if someone opens the main door — > sent my notification massage

-area home . config.
-door sensor . config
-phone device. config.

I create something like that it’s not work
because the condition state - “not home” it is not recognized it think

	  - id: '1577885645375'
  alias: test
  description: ''
  trigger:
  - entity_id: binary_sensor.door_window_sensor_158d00042e4298
    from: 'off'
    platform: state
    to: 'on'
  condition:
  - condition: and
    conditions:
    - condition: state
      entity_id: device_tracker.aa
      state: not home
  action:
  - data:
      message: 'test notify'
    service: notify.mobile_app_aa

You need to write the devicer_tracker state as “not_home”:

condition:
  - condition: state
    entity_id: device_tracker.aa
    state: 'not_home'
1 Like

And just to clarify the above…

you don’t need to put in the code for the “and” saince all conditions are “and” by default.

So this would be your entire “condition:” section (as written above):

condition:
  - condition: state
    entity_id: device_tracker.aa
    state: not_home
1 Like

I appreciate the support (and the love :heart:) but mine wasn’t really the solution. It was just expounding on the solution already given above by @dennis84de.

Thanks
I fix it (:slight_smile: