Hi, I have being using HA for a year, but I still very new about lots of HA concepts. Before I was using openhab, so I have some problem understanding some concepts and workflows.
As the title say I’m trying to understand how entities works on a day-to-day basis. I understand that entities is the last piece of info of a device, the info itself, the switch (on/off) the temperature) etc.
But what I´m trying to understand for example is why some devices are implemented as entities, for example sonoff lan from hack, the devices are entities, is this because of a bad implementation, a limitation of the system or by design?. Another case is the MQTT integration, I have a sonoff bridge with tasmota and the rf remote, I define each button with I´s MQTT messages in yaml, so i see every button as an entity, in this the correct way, is there a way to create a device and configure all button inside?
Hi, i just headed over from openHAB (instance is still running) and i have the same problem. Im openhab there is the concept og thing that sounds to me similar to a device. Same with channel, items and entities.
So one question is for me as well how to define a device and assign some entities to it. Example is maybe a miflora plant sensor. With my openHAB experience i would like to create a device called MiSensor 01 and assign entities like temperature, battery and humidity.
Questions and more questions
Devices are collections of entities.
Entities can be added to a device by the integration developer. This is completely optional though. So if you want device support you will have to ask the developer to add it.
A device is created by an integration, they can be for specific brands like mi flora, or can be something connected via MQTT or ESPhome that you have defined yourself.
As for mi flora, there is already an integration that will let you add these as a device with entities.
Miflora was just an example and unfortunately the integration relies on a local BLE device. I habe more than 15 sensors spread over my home and cannot reach all from one point. mqtt discovery is as well no solution, because esphome does not send battery values and the tasmota ble has not autodiscovery.
Based on this i habe to create a lot of entities by hand.
But what i understand is: It is only possible to create devices from an integration and not using a yaml file.
Correct.
Yes as Tom said you need an integration.
But MQTT is an integration that allows you to define devices in configuration.yaml - so if your devices are MQTT based but do not auto discover, you can still subscribe to topics and have these appear as devices. For example:
- platform: mqtt
name: "Kitchen Temperature"
state_topic: "tele/sonoff5/SENSOR"
value_template: "{{ value_json['AM2301'].Temperature }}"
unit_of_measurement: "°C"
- platform: mqtt
name: "Kitchen Humidity"
state_topic: "tele/sonoff5/SENSOR"
value_template: "{{ value_json['AM2301'].Humidity }}"
unit_of_measurement: "%"
That config will produce entities, not devices.
You can create mqtt auto-discovery messages yourself, and that allows you to create devices.
This is the part that I’m missing. I will have to read the docs again.
Openmqttgateway creates devices, entities leveraging mqtt auto discovery and read mi flora battery.
I will check that out