embyt / enocean-mqtt

Receives messages from an enOcean serial interface (USB) and provides selected messages to an MQTT broker.
GNU General Public License v3.0
42 stars 21 forks source link

Error in device selection when sending data #43

Closed mak-gitdev closed 1 year ago

mak-gitdev commented 1 year ago

Hi @romor,

Another issue has just been found. Please have a look at mak-gitdev/ha_enoceanmqtt#73 for more details.

The problem is that in some cases, we select the wrong device for sending data. This happens when two or more devices have very similar names as the device selection only checks whether the sensor name is IN the MQTT topic (L135 and L172)

One solution would be to add / at the end of the current sensor name when checking if the current sensor is the targeted one.

if cur_sensor['name']+"/" in msg.topic:

This has been tested and effectively fixed the issue.

romor commented 1 year ago

Thanks for fixing this.