After editing and inserting the mqtt switch code as per as the website even I have enter the broker home assistant is showing me switch is unavailable please tell me a solution.
mqtt:
broker : 127.0.0.1
switch:
- platform: mqtt
name: “Bedroom Switch”
state_topic: “home/bedroom/switch1”
command_topic: “home/bedroom/switch1/set”
availability_topic: “home/bedroom/switch1/available”
payload_on: “ON”
payload_off: “OFF”
optimistic: false
qos: 0
retain: true