Hello,
i am using my own mqtt server not hassio add on. I have added the following to the configuration.yaml file:
mqtt:
broker: !secret mqtt_url
port: !secret mqtt_port
username: !secret mqtt_user
password: !secret mqtt_pass
client_id: home-assistant
discovery: true
discovery_prefix: homeassistant
switch:
- platform: mqtt
name: “sonoff”
state_topic: “stat/sonoff/RESULT”
value_template: ‘{{ value_json[“POWER1”] }}’
command_topic: “cmnd/sonoff/POWER1”
availability_topic: “tele/sonoff/LWT”
qos: 1
payload_on: “ON”
payload_off: “OFF”
payload_available: “Online”
payload_not_available: “Offline”
retain: true
I ran the CHECK CONFIG and it reported Valid.
When I restart HA i get the message INVALID CONFIG:
The following components and platforms could not be set up:
mqtt
switch.mqtt
Please check your config
I have set user and password for mqtt server and homeassistant connects to it without any issues. I have even publish to the topic to turn the switch on from home assistant mqtt integration page and it works fine. But i just can’t add switch, is there something that i am missing?
Thank you very much for any upcoming messages.