logo elektroda
logo elektroda
X
logo elektroda

[Solved] How do I add a switch (in Home Assistant) via MQTT Home Assistant discovery?

krzbor 213 1
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
  • #1 21175795
    krzbor
    Level 27  
    I have a question regarding HA discovery. I want to add a switch via MQTT. It works fine but:
    How do I add a switch (in Home Assistant) via MQTT Home Assistant discovery? .
    instead of getting a switch in the style shown by the green arrow I get something with lightning (red arrow). How via MQTT HA discovery do I add a switch in the style shown by the green arrow?
  • ADVERTISEMENT
  • #2 21182580
    krzbor
    Level 27  
    It turns out that in order to get the correct switch instead of lightning, you need to define "state_topic" in addition to "command_topic". That's not all! HA checks whether "state_topic" really exists - presumably it checks whether the MQTT broker publishes such a thing. If all conditions are fulfilled, the "lightning" turns into a regular switch.
ADVERTISEMENT