Open jedie opened 4 months ago
Have the same problem, It seems it has something to do that the lib creates multiple instances of the mqtt connection in parallel and starts multiple mqtt_client loops.
Right now, I don't see any easy fix as the connection is established when the Device object is created. There is no way to setup a "global" mqtt client object.
I've implemented some ugly hacks to "fix" this for my local instance, but
I simply check in the callback method which topic was set for the message to know for which device the message was send. And its v0.13.1 as I am running this on raspi 1 which is still arm32 and which does not support pydantic2.
Describe the bug
command_callback
do not work reliably when a device has multiple entities.To Reproduce Here a minimal example script. It creates one device and add a Sensor and a Switch:
It works, if the "temperature sensor" will be not initialized. Then you can switch the "Relay" ON and OFF in Home Assistant and the callback will be call every time. But if the "temperature sensor" is also added, then the callback will be sometimes called and sometimes not.