Geo_location/device tracker automation isnt working and phone based automation for remote UI not triggering

Hi, I tried to do the most basic automation I guess everyone here is doing first: automatically turn the lights off, when I leave the home.

I tried to do this with two different triggers:

alias: lights off
description: ""
trigger:
  - platform: device
    device_id: 755e618622f9af3c724f61eee72e8628
    domain: device_tracker
    entity_id: 250d847219a1d8097a6c7f2211589ee9
    type: leaves
    zone: zone.home
condition: []
action:
  - type: turn_off
    device_id: d0f855453e8e250fd9df6e0d2c94062e
    entity_id: 5007d682a3616f214cf018e2200947f9
    domain: remote
  - type: turn_off
    device_id: b19737e3ccd2984a2ebc427731d69767
    entity_id: bd523846533759f5529089de327413d2
    domain: light
  - type: turn_off
    device_id: f2af9cebd275f29b3f3b4cdb171dc634
    entity_id: 7fe28c2de5754604bb0431252e442b50
    domain: light
  - type: turn_off
    device_id: 71efb91719e3bdeaea5169ae96ad4c7c
    entity_id: 0becf7c5b22306ff5ebde43f84012b03
    domain: light
mode: single

and

alias: lights off v2
description: ""
trigger:
  - platform: geo_location
    source: device_tracker.[phone] 
    zone: zone.home
    event: leave
condition: []
action:
  - type: turn_off
    device_id: d0f855453e8e250fd9df6e0d2c94062e
    entity_id: 5007d682a3616f214cf018e2200947f9
    domain: remote
  - type: turn_off
    device_id: b19737e3ccd2984a2ebc427731d69767
    entity_id: bd523846533759f5529089de327413d2
    domain: light
  - type: turn_off
    device_id: f2af9cebd275f29b3f3b4cdb171dc634
    entity_id: 7fe28c2de5754604bb0431252e442b50
    domain: light
  - type: turn_off
    device_id: 71efb91719e3bdeaea5169ae96ad4c7c
    entity_id: 0becf7c5b22306ff5ebde43f84012b03
    domain: light
mode: single

The same happens when trying to automatically connect to the nabu casa cloud for HA. Both are phone based triggers so I assume there must be something stopping to send state changes?

alias: "Cloud deaktivieren "
description: ""
trigger:
  - type: turned_on
    platform: device
    device_id: 755e618622f9af3c724f61eee72e8628
    entity_id: 2059450f8ad712b1fbe5ff9f92a372e1
    domain: binary_sensor
condition: []
action:
  - service: cloud.remote_disconnect
    data: {}
mode: single
alias: Automatischer cloudzugriff
description: ""
trigger:
  - type: turned_off
    platform: device
    device_id: 755e618622f9af3c724f61eee72e8628
    entity_id: 2059450f8ad712b1fbe5ff9f92a372e1
    domain: binary_sensor
condition: 
action:
  - service: cloud.remote_connect
    data: {}
mode: single

Your first trigger looks fine, post the automation trace so we can see what is going on with it.

But your second trigger…

This is a nonsense trigger configuration… Geolocation triggers are not based on your device trackers, they are based on comparing defined zones with data provided by an outside source, mostly related to natural disaster and emergency alert systems.

I don’t know whether it is related but my wife’s Iphone (using the HA Nabu App) location sharing all the time changes from “always” to “when using the app”. The same happens when using Google Maps sharing, so I assumem it is an IOS issue and HA.

That’s my trace, I have never triggered the trigger node but testing the action showed that the lights turn off if the trigger would work.

sadly it doesnt update on opening the app/ I am using an android phone. I think it has to be some kind of permission thing, because the actions are correct, just the trigger doesnt work.

Have you followed the troubleshooting FAQ?

Why not go by user instead of device tracker?
a device tracker is connected to a user
so I use this

- id: Turn off the lights when I leave home
  alias: Turn off the devices when no one is at home
  description: Turn off the devices when no one is at home
  trigger:
  - platform: state
    entity_id: group.users
    to: not_home
  condition: []
  action:
  - service: switch.turn_off
......

this is for when all users leave home, but you can tie entity to only you if needed,
probably it doesn’t matter if you live alone.

Going through the settings and troubleshooting in the companion app I found out, that the Tracking worked, but the information is not send, I get multiple entries in the troubleshoot that look like this:

Created: 2023-12-18 18:24:00.591
Trigger: FLP_BACKGROUND
Result: FAILED_SEND
Data: UpdateLocation(gps=[x,y], gpsAccuracy=24, locationName=null, speed=0, altitude=100, course=0, verticalAccuracy=2)

Location: x,y.
Accuracy: 24
Server: Home

Might it be, that home assistant cant communicate with my server since the remote UI trigger isnt working as well?

Yes, if you are turning off remote access while you are home, you will need to have a “stationary” device tracker (bluetooth, router, or network based) that can determine when you have left without requiring input from the phone app, since it will not be connected.

I thought that triggering the remote access whenever I disconnect my phone from wifi might be a suitable trigger for the remote access but apparently I can’t connect to the cloud while not in my home network, the trigger to start the remote access must happen while still at home. I’ll have to experiment with an always on remote access and see if that will help.