Run alexa routine based on phone location/wifi

Hi, I have some led Lights that I would like to switch on and off when I enter/exit my house. If there is a delay of a few mins etc, that is fine…
The lights are not recognized by ha, but are controllable via Alexa.
Ideally I wanted ha to recognize when my phone connects and disconnects to my wifi, and use that as the trigger using nmap, but nmap doesn’t want to list my phone as an entity for some reason. I can see it in ha vis companion app etc.
I have Alexa media player setup and working. I can get Alexa to speak via tts.
Being very new to ha, I am struggling to work out how to make an automation to run an Alexa routine, or simply switch on an Alexa device based on my phones location… is this only possible via config.yaml, or can I do it via gui? If config.yaml, an example of the txt would be very much appreciated! As im getting in over my head a bit now! Thank you :smiley:

1 Like

I’ve tried a simple automation, turn off living room light based on leaving my house zone and phones location. Doesn’t seem to work. Tried ifttt and tasker, it works, but only occasionally. Hence why I really need it to be based on when my phone connects to my wifi network, presumably should be more reliable…

Ok I’ve managed to get ha to toggle my livingroom Iight based on a change of my wifi ssid.

I added this to config.yaml

      
  - platform: template
    sensors:
      mixfoldconnectedtohomewifi:
        value_template: >-
          {% if states('sensor.mixfold3_wifi_connection') == "tplinkhome5G" %}
            home
          {% else %}
            not_home
          {% endif %}
        friendly_name: 'MixFold3 WiFi (SSID = tplinkhome5G)'


That gives me a sensor that I can use to trigger an Alexa device or routine… but just how I trigger an Alexa device I’m not sure. I think the Alexa media player had some info on that, so I’ll have a read. Unless anyone has a suggestion? Thanks

Although, I don’t see how using the companion app will work anyway as as soon as I leave my network, the app no longer is able to do anything, so no wifi sensors will update etc, or presumably location. So back to square one.

Any help? Anyone?

I guess not. Didn’t think this would be beyond those on this forum…