Shelly 1 will topic and message

Tags: #<Tag:0x00007f739b92a3b8>

I am trying to connect my Shelly 1 to home MQTT. I cannot get the Shelly to communicate the state. I think I am missing something in the Shelly’s will topic and will message. I have tried blank for both and the same as in my config . Currently have

shellies/shellyswitch-944C83/relay/0 In my topic. Don’t know what message to put or even if I am doing it right.

here is a configuration that includes the LWT for a shelly1:

  - platform: mqtt
    name: "Storage Room Light"
    state_topic: "shellies/shelly1-32CADF/relay/0"
    command_topic: "shellies/shelly1-32CADF/relay/0/command"
    availability_topic: 'shellies/shelly1-32CADF/online'
    qos: 0
    payload_on: "on"
    payload_off: "off"
    payload_available: "true"
    payload_not_available: "false"
    retain: false

then in the box for the LWT in the shelly itself:

You can use this script to easy add Shelly1 to the HA.

Thank you, I had the “relay” verbiage in the online topic statement. Thanks for your config. it is working now.

Thanks for the script. I have the one shelly working now thank to the config provided. I am also going to work on adding your script and get the discover working. I plan on adding several more and a little work up front will help out in the end.