Xiaomi_BLE_Temperature_Display_for_HA
Xiaomi_BLE_Temperature_Display_for_HA copied to clipboard
The count (-c) parameter doesn't work
Hello, i have installed the script on a fresh Raspbian installation. It seems that the count option has no effect at all. With -c 1 the script should stop after the first run bit it goes ahead.
sudo ./LYWSD03MMC.py -d A4:C1:38:14:44:47 -r -b 5 -c 1 -m 192.168.1.16 -del 20 You do not have mqtt installed, which is needed to talk to the broker. Install using sudo pip3 install paho-mqtt args.device A4:C1:38:14:44:47 ['A4:C1:38:14:44:47'] 1 Delay set to 20 seconds Trying to connect to A4:C1:38:14:44:47 Temperature: 20.9 Humidity: 48 Battery voltage: 2.993 Battery level: 89 1 measurements collected. Exiting in a moment. Topic blemqtt/A4C138144447 measurements deque([Measurement(temperature=20.9, humidity=48, voltage=2.993, calibratedHumidity=0, battery=89, timestamp=1586246922)]) 20.9 Publishing {"temperature": "20.9", "humidity": "48", "batt": "89", "voltage": "2.993"} Connection lost Waiting... Trying to connect to A4:C1:38:14:44:47 Temperature: 21.0 Humidity: 47 Battery voltage: 2.993 Battery level: 89 1 measurements collected. Exiting in a moment. Topic blemqtt/A4C138144447 measurements deque([Measurement(temperature=20.9, humidity=48, voltage=2.993, calibratedHumidity=0, battery=89, timestamp=1586246922), Measurement(temperature=21.0, humidity=47, voltage=2.993, calibratedHumidity=0, battery=89, timestamp=1586246938)]) 20.9 Publishing {"temperature": "20.9", "humidity": "48", "batt": "89", "voltage": "2.993"} Connection lost Waiting... Trying to connect to A4:C1:38:14:44:47
Hi
The first thing you need to do is install the mqtt client using sudo pip3 install paho-mqtt
as shown in your output above.
The script will be raising an exception before it gets to the delay because the mqtt publish will be failing.
I installed the paho-mqtt packet. Problem still exists.
Can you show me your output again please - like you did in the first post?
JsBergbau fixed it.
https://github.com/JsBergbau/MiTemperature2/releases/tag/v1.8
Ah. I see your confusion. In my script I have changed the behaviour of the -c to be the number of readings taken from a device before moving on to the next one. My script behaves exactly as designed. -del let’s you set the delay in seconds between changing devices.
Ok thanks. I will give it another try.
You might be interested in my new repository that uses ESP32 instead of Raspberry Pi https://github.com/AnthonyKNorman/Xiaomi_LYWSD03MMC_for_HA