Issues with wifi component

Hi, I’m triggering a led based on the Wi-Fi state. If I reboot the device, the LED is green as instructed. If I disconnect the device, the led flashes RED as instructed.

However, when the device reconnects to Wi-Fi, it does not change back to green, and rather continues to flash RED.

Any ideas why this is?

Thanks

wifi:
  networks:
  - ssid: !secret wifi_ssid
    password: !secret wifi_password
    bssid: xx:xx:xx:xx:xx:xx
  fast_connect: true
  on_connect:
    - light.turn_on:
        id: led
        brightness: 100%
        red: 0%
        green: 100%
        blue: 0% 
  on_disconnect:
      - light.control:
          id: led
          state: on
          effect: ERROR