Xiaomi_BLE_Temperature_Display_for_HA icon indicating copy to clipboard operation
Xiaomi_BLE_Temperature_Display_for_HA copied to clipboard

The count (-c) parameter doesn't work

Open tuccler opened this issue 4 years ago • 7 comments

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

tuccler avatar Apr 07 '20 08:04 tuccler

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.

AnthonyKNorman avatar Apr 07 '20 08:04 AnthonyKNorman

I installed the paho-mqtt packet. Problem still exists.

tuccler avatar Apr 14 '20 07:04 tuccler

Can you show me your output again please - like you did in the first post?

AnthonyKNorman avatar Apr 14 '20 07:04 AnthonyKNorman

JsBergbau fixed it.

https://github.com/JsBergbau/MiTemperature2/releases/tag/v1.8

tuccler avatar Apr 14 '20 16:04 tuccler

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.

AnthonyKNorman avatar Apr 14 '20 18:04 AnthonyKNorman

Ok thanks. I will give it another try.

tuccler avatar Apr 15 '20 08:04 tuccler

You might be interested in my new repository that uses ESP32 instead of Raspberry Pi https://github.com/AnthonyKNorman/Xiaomi_LYWSD03MMC_for_HA

AnthonyKNorman avatar Apr 27 '20 05:04 AnthonyKNorman