Help with shelly and switch status on HA dashboard

Dear all, i need help to solve a problem with Shelly 1/PM/EM
This is the scenario:

Every time in my house there is a power outage the switch status of my shellys on HA dashboard remain to ON (switched on) without change its status to off … and this is very frustrating.

Someone could help me to find a solution?
I wanna that if my shelly doesn’t have power the switch goes to off status.

Thanks a lot.

How are you connecting the Shelly to home assistant?

MQTT or the Shelly custom component?

Hi! I’m using mqtt in my configuration.yaml

  - platform: mqtt
    name: "DOOR LIGHT"
    state_topic: "shellies/shelly1-B8E17F/relay/0"
    command_topic: "shellies/shelly1-B8E17F/relay/0/command"
    qos: 0
    payload_on: "on"
    payload_off: "off"
    optimistic: false
    retain: false