Actually, I got the LWT function functioning perfectly fine on my relay:
mqtt:
button:
- unique_id: button-gate-open
name: "Open Gate"
command_topic: "/dingtian/relay1234/in/control"
availability:
- topic: "/dingtian/relay1234/out/lwt_availability"
payload_available: "online"
payload_not_available: "offline"
payload_press: '{\"type\":\"JOGGING\",\"idx\": \"1\",\"status\":\"ON\",\"time\":\"5\",\"pass\":\"0\"}'
qos: 0
retain: false
device:
name: "Dingtian 8 port Relay 1234"
connections:
- ["mac", "12:34:56:78:90:AB"]
configuration_url: "http://192.168.1.12"
hw_version: "V3.6J"
sw_version: "V3.1.1759A"
manufacturer: "Dingtian"
model: "DT R008"
suggested_area: "Outside"
The gate control only needs a momentary input, so I thought it would be better to add it as a button…
I have no idea why I have to escape all the quotation marks in the payload but the configuration check complains if I don’t do so…
Nice addition is the device info, like this it gathers all relevant info for the button and groups all buttons and binary_sensors from this device. I quite like it!