ELK M1 Interface

That MQTT topic’s structure is unique to Premise.

In Premise, all objects are arranged in a hierarchy where each level represents a location. The topmost level is always Home. Here’s my garage door opener’s full path name:

  • Home.House.Garage.GarageDoor.Toggler

Each object’s MQTT topic is automatically created and is based on its path name. It begins with the word premise followed by the entity’s path name, and ends with the property you wish to use. The Toggler has one principal property called State therefore its two topics (for status and command) are:

  • premise/home/house/garage/garagedoor/toggler/state
  • premise/command/home/house/garage/garagedoor/toggler/state

In Home Assistant, there’s no equivalent structure to define an entity’s location. For example, cover.garage_door_opener is the entity and its location is (optionally) implied by the name you give it (i.e. the word ‘garage’ in garage_door_opener). Most relevant to this discussion is there’s no automatic creation of MQTT topics for an entity. There’s no automatically-generated MQTT topic such as homeassistant/covers/cover.garage_door_opener. That’s not to say it can’t be done, just that there’s a bit more work involved.

For automatically publishing an entity’s state-changes (i.e. its status topic) you can use an automation or a component called MQTT Statestream designed for this very purpose. It publishes the state-changes of one or more entities. However, MQTT Statestream doesn’t allow you to control an entity (i.e. there’s no command topic). For that, it’s my understanding you have to create an automation.

Here’s an example of this scenario. The individual has existing TP-Link switches defined with the switch component and the TP-Link platform. They also want to allow an MQTT client to control the TP-Link switches. In other words, they want Home Assistant to subscribe to command topics and use the received messages to control the TP-Link switches. The solution is an automation:

Alternately, you can control those switch entities via Home Assistant’s existing and comprehensive REST API. However, if you want to control them via MQTT then the example above gets the job done.