ThomDietrich / miflora-mqtt-daemon

Linux service to collect and transfer Xiaomi Mi Flora plant sensor data via MQTT to your smart home system, with cluster support 🌱🌼🥀🏡🌳
MIT License
606 stars 141 forks source link

Error: The MAC address "..." seems to be in the wrong format. #174

Open Zjaaspoer opened 4 months ago

Zjaaspoer commented 4 months ago

Hi, I've been using your daemon successfully for years, thank you for that. A few days ago I bought new MiFlora sensors (same type). But now I'm getting validation errors with the new MAC addresses:

Xiaomi Mi Flora Plant Sensor MQTT Client/Daemon

[2024-02-21 19:53:17] Connecting to MQTT broker ...

Adding sensor to device list and testing connection ...
Name:          "ficus"
Device name:   "Flower care"
MAC address:   C4:7C:8D:6A:DC:34
Firmware:      3.3.5
[2024-02-21 19:53:21] Initial connection to Mi Flora sensor "ficus" (C4:7C:8D:6A:DC:34) successful

Adding sensor to device list and testing connection ...
Name:          "hangachter"
Device name:   "Flower care"
MAC address:   C4:7C:8D:6D:51:2C
[2024-02-21 19:53:23] Initial connection to Mi Flora sensor "hangachter" (C4:7C:8D:6D:51:2C) successful

Adding sensor to device list and testing connection ...
Internal name: "hangvoor"
MAC address:   C4:7C:8D:6D:3A:61
Firmware:      3.2.4
[2024-02-21 19:53:26] Initial connection to Mi Flora sensor "hangvoor" (C4:7C:8D:6D:3A:61) successful

Xiaomi Mi Flora Plant Sensor MQTT Client/Daemon
Source: https://github.com/ThomDietrich/miflora-mqtt-daemon

[2024-02-21 19:53:38] Connecting to MQTT broker ...

Adding sensor to device list and testing connection ...
Name:          "ficus"
Device name:   "Flower care"
MAC address:   C4:7C:8D:6A:DC:34
Firmware:      3.3.5
[2024-02-21 19:53:42] Initial connection to Mi Flora sensor "ficus" (C4:7C:8D:6A:DC:34) successful

Adding sensor to device list and testing connection ...
Name:          "hangachter"
Device name:   "Flower care"
Firmware:      3.2.4
[2024-02-21 19:53:44] Initial connection to Mi Flora sensor "hangachter" (C4:7C:8D:6D:51:2C) successful

Adding sensor to device list and testing connection ...
Name:          "hangvoor"
Device name:   "Flower care"
MAC address:   C4:7C:8D:6D:3A:61
Firmware:      3.2.4
[2024-02-21 19:53:46] Initial connection to Mi Flora sensor "hangvoor" (C4:7C:8D:6D:3A:61) successful

[2024-02-21 19:53:46] The MAC address "5C:85:7E:12:AB:60" seems to be in the wrong format. Please check your configuration

This seems to be related to this piece of code. But the RegExp does match the MAC addresses it trips over.

As you can see it connects properly to my old devices (starting with C4:...) but is tripping over any of the new devices. I've made sure the strings are correct and not hiding any copy/paste hidden special characters or something of the sorts.

I've tried this on several machines, they are all giving the same issues.

ThomDietrich commented 4 months ago

Hey! This is odd indeed but when I run your log posting from above through he following it correctly accepts your "5C:..." mac address.

https://pythex.org/?regex=%5B0-9a-f%5D%7B2%7D%3A%5B0-9a-f%5D%7B2%7D%3A%5B0-9a-f%5D%7B2%7D%3A%5B0-9a-f%5D%7B2%7D%3A%5B0-9a-f%5D%7B2%7D%3A%5B0-9a-f%5D%7B2%7D&test_string=&ignorecase=1&multiline=0&dotall=0&verbose=0

I've made sure the strings are correct and not hiding any copy/paste hidden special characters or something of the sorts.

This would have been my guess... Very strange. Temporarily comment out this line and see what happens https://github.com/ThomDietrich/miflora-mqtt-daemon/blob/59cd5abc86c2d4d005a084ebba144ab4c0b73feb/miflora-mqtt-daemon.py#L182

Zjaaspoer commented 4 months ago

Will try!