I’m not having much success finding information on this, so hopefully someone can help me out.
I am creating my own simple smart home devices and connecting them through Mosquitto to Home Assistant. So far in my tests my devices are showing up as “entities” (but not as “devices”) in the Home Assistant configuration.
What I am hoping to do is to use the MQTT auto-discovery to have the devices appear in the Home Assistant UI and then be assignable to a room. I’m starting to suspect that it isn’t possible to do that assignment through the HA UI and, instead, the device itself my specify the room it is in through its MQTT config.
I’m rather hoping it’s the former as, to me, it makes sense to be able to simply plug in a device in a room and not have to configure it through its own UI. Being able to see that device auto-discovered in the HA UI and then assigning the room it is in would work well.
Is it possible to do what I’m looking for here? Thanks!
You can’t auto-add an area via discovery but you should be able to create devices, not just ungrouped entities. I don’t have much experience doing this manually myself but here’s an example of a discovery payload Zigbee2MQTT sent for one of my lights which created a device:
I provided someone else with an example of how to use a script to create an entity via MQTT Discovery. It also includes an example of defining a device (i.e. the entity becomes part of the device). The script itself is simple, it publishes a retained payload to a topic. The real work is in defining the payload.
Please note that in previous versions, only a device could be assigned to an area but now it can also be done for entities (so it may obviate your need to define devices).
The method you linked to, @123, has solved my problems and answered my questions! I now have a standard firmware I can flash to these devices and have them announce themselves by MAC address for differentiation.