Can someone provide a complete example on how i can map an MQTT topic to an actual switch entity in HA both write and read?
So lets say i have an entity:
switch.foo_bar
Do i need to do something like this:
mqtt:
- switch:
unique_id: bedroom_switch
name: "Bedroom Switch"
state_topic: "home/bedroom/switch1"
command_topic: "home/bedroom/switch1/set"
Then subscribe to the topic and map events to actions that change foo_bar then do the other way round and post when something changes or there is an easier way?