Sonoff POW Power state report

Hi - I have homeassistant with basic sonoff switches and POW and POW R2 switches. I cannot get the switches to report their power state correctly if the server restarted.

Here is my config for the basic switches :slight_smile:

  • platform: mqtt
    name: “Pool Water”
    state_topic: “stat/poolwater/POWER”
    value_template: “{{ value_json.POWER }}”
    command_topic: “cmnd/poolwater/POWER”
    payload_on: “ON”
    payload_off: “OFF”
    availability_topic: “tele/poolwater/LWT”
    payload_available: “Online”
    payload_not_available: “Offline”
    qos: 1
    retain: false

Here is my config for the POW switches

  • platform: mqtt
    name: “Pump Garden”
    state_topic: “stat/pumpgarden/POWER”
    value_template: “{{ value_json.POWER }}”
    command_topic: “cmnd/pumpgarden/POWER”
    qos: 1
    payload_on: “ON”
    payload_off: “OFF”
    retain: false

Please assist - thanks so much

Put this in automations.yaml :

- id: '1565194745362'
  alias: Status when starting HA
  trigger:
  - event: start
    platform: homeassistant
  condition: []
  action:
  - data:
      payload: ''
      topic: cmnd/tasmotas/status
    service: mqtt.publish
  - data:
      payload: ''
      topic: cmnd/sonoffs/status
    service: mqtt.publish