JsBergbau / MiTemperature2

Read the values of the Xiaomi Mi Bluetooth Temperature sensor 2 including custom encrypted format.
705 stars 162 forks source link

running with sensors.ini doesn't work #115

Closed lecocqe closed 2 years ago

lecocqe commented 2 years ago

Hello,

i'm facing the following issue. i run ./LYWSD03MMC.py -df sensors.ini --callback sendToMQTT_HA.sh. it gives the help iso running

can you give me a hint ?

regards,

sensors.ini

[A4:C1:38:C6:C5:D3]
sensorname = theo

senToMQTT_HA.sh (i know this is not complete, i copied the screen)

#!/bin/bash

#This script is provided by Chiunownow https://github.com/Chiunownow
#Thank you very much for providing this script
#This script is

#use e.g with that script: MySensor.sh
#!/bin/bash
#DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
#$DIR/LYWSD03MMC.py -d <device> -b 1000 -r --debounce --skipidentical 50 --name MySensor --callback sendToMQTT

broker="192.168.x.x"
port=1883
username="me"
password="mypsw"

mosquitto_pub -h $broker  -p $port -t "homeassistant/sensor/$2_temp/config" -u $username -P $password -i "mibridge" -m '{"device_class": "temperature$
mosquitto_pub -h $broker  -p $port -t "homeassistant/sensor/$2_humi/config" -u $username -P $password -i "mibridge" -m '{"device_class": "humidity", $
mosquitto_pub -h $broker  -p $port -t "homeassistant/sensor/$2_battlevel/config" -u $username -P $password -i "mibridge" -m '{"device_class": "batter$
mosquitto_pub -h $broker  -p $port -t "homeassistant/sensor/$2_battvolt/config" -u $username -P $password -i "mibridge" -m '{"device_class": "voltage$
mosquitto_pub -h $broker  -p $port -t "homeassistant/sensor/$2/state" -u $username -P $password -i "mibridge" -m '{ "temperature": '$3', "humidity": $
JsBergbau commented 2 years ago

Hi lecocqe, sorry for the late reply. Devicelistfile is a passive mode related argument:

Passive mode related arguments:
  --passive, -p, --atc, -a
                        Read the data of devices based on BLE advertisements, use --battery to get battery level additionaly in percent
  --watchdogtimer X, -wdt X
                        Re-enable scanning after not receiving any BLE packet after X seconds
  --devicelistfile DEVICELISTFILE, -df DEVICELISTFILE
                        Specify a device list file giving further details to devices
  --onlydevicelist, -odl
                        Only read devices which are in the device list file
  --rssi, -rs           Report RSSI via callback

so you need to add --passive argument.

For more info please see https://github.com/JsBergbau/MiTemperature2/issues/114

lecocqe commented 2 years ago

Hi,

thank you for your help. Now, command runs but no info received from devices ? any idea ? devices still have xiami fw.

Regards

JsBergbau commented 2 years ago

Did you read https://github.com/JsBergbau/MiTemperature2/issues/114 ? Thats exactly the problem you're describing.

lecocqe commented 2 years ago

Hello, after flashing the right fw and solve some low battery issues. it works like a charm. Thank you very much