Automation when connected to SSID

I’m trying to setup up an automation that sends a notification when my phone has connected to the home wifi and when it disconnects.

The automation through the UI runs when the status changes to NOT CONNECTED and that works fine, but when I run a separate automation that is triggered when status the status changes to ‘Ubiquiti’ the automation doesn’t run. Any thoughts would be appreciated…

alias: Rob's phone
description: ""
trigger:
  - platform: state
    entity_id:
      - sensor.robs_iphone_2_bssid
    from: Not Connected
condition: []
action:
  - service: notify.mobile_app_robs_iphone_2
    data:
      message: Disconnected from Ubiquiti WIFI
      data:
        message: disconnected from Ubiquiti
mode: single
alias: Rob's phone connected to wifi
description: ""
trigger:
  - platform: state
    entity_id:
      - sensor.robs_iphone_2_bssid
    to: Ubiquiti
condition:
  - condition: state
    entity_id: sensor.robs_iphone_2_bssid
    state: Ubiquiti
action:
  - service: notify.mobile_app_robs_iphone_2
    data:
      message: Connected to Ubiquiti WIFI
      data:
        message: Connected to Ubiquiti

Use mac direction like this:

For enter in wifi:

trigger: state
entity_id:

  • sensor.rmx2063_wi_fi_bssid
    for:
    to: 76:d7:9a:cb:fa:8c
    alias: Encendido luces Taller cuando presente

For Exit:

alias: Apagado luces Taller cuando no presente
trigger: state
entity_id:

  • sensor.rmx2063_wi_fi_bssid
    for:
    to: null
    from: 76:d7:9a:cb:fa:8c