Automation based on phones wifi connection

I am trying to get an automation where lights turn on when on my phone connects to wifi. I have my router added as an integration. When I create the automation based on the state I cannot seem to get it to work.

Here is the yaml code:

Try using enter/leave zone home as a trigger.

I added that trigger and will see how it works tomorrow once I come back home.

That trigger still didn’t make the automation run after leaving and returning home. Any other tips?

It should work unless. Check if your mob is reporting entering leaving zone. In automation i prefer using building block and then choose trigger. Of course you have to add trigger id to do it. Something like this:

description: ""
trigger:
  - platform: zone
    entity_id: person.daniel
    zone: zone.home
    event: leave
    id: Leave home
  - platform: zone
    entity_id: person.daniel
    zone: zone.home
    event: enter
    id: Arrive home
condition: []
action:
  - choose:
      - conditions:
          - condition: trigger
            id:
              - Leave home
        sequence:
          - metadata: {}
            data: {}
            action: alarm_control_panel.alarm_arm_away
            target:
              entity_id: alarm_control_panel.x824_house_entrance_2
      - conditions:
          - condition: trigger
            id:
              - Arrive home
        sequence:
          - metadata: {}
            data: {}
            action: alarm_control_panel.alarm_disarm
            target:
              entity_id: alarm_control_panel.x824_house_entrance_2
mode: single

I use this to turn on or off alarm. It works with out any issue. The same concept is for your automation.