Ping sensor and autmations

Hi

I try to send a email, when I ping a switch (meens power gone in the house)

binary_sensor:

- platform: ping
  name: sw_stue
  host: 192.168.13.11
  count: 2
  scan_interval: 30

Automations:

- id: "ping_sw_stue"
  alias: Ping sw stue
  trigger:
    platform: state
    entity_id: binary_sensor.sw_stue
    from: 'on'
    to: 'off'
  action:
    - service: script.test_notification_03     

scripts:

test_notification_03:
  alias: Test Notification 03
  sequence:
  - service: notify.eh_gmail
    data:
      title: alert
      message: This is a test notification 03!

test_notification_03 work fine, it send the email

when I press trigger under automation its work
hassio-03

But if power off the switch, it dont send the email.

What do I wrong?

I have googlet a lot, but I cant find the answer:cry:

BG Erling

If you turn off the Sensor from Power, the sensor does not have the entity off, look in the status which status the sensor has. Probably unaviable and not off

Check too that the automation is turned on

Automation is on and the ping sensor say Disconnected / Connected, but I have try that too, with no luck.