MiTemperature2
MiTemperature2 copied to clipboard
sendToDomoticz.py errors
Hi, there are few errors in sendToDomoticz.py first of all val_bat = sys.argv[6] sys.argv[6] is actualy timestamp and sys.argv[5] is voltage. Also domoticz accepts percentage (0-100) for battery
I modified this file for my self like this:
def translate(value, leftMin, leftMax, rightMin, rightMax):
leftSpan = leftMax - leftMin
rightSpan = rightMax - rightMin
valueScaled = float(value - leftMin) / float(leftSpan)
return rightMin + (valueScaled * rightSpan)
val_bat = str(translate(float(sys.argv[5]),1.8,3.3,0,100))
I'm assuming that max is 3.3 (I just bought 9 of this sensors and some are reporting 3.23) and for low I set it at 1.8 but I really don't know what is lowest voltage on which this sensors work.
Hi siklosi,
arg number depends on how you call the script. Take a look there https://github.com/JsBergbau/MiTemperature2/issues/59#issuecomment-753654764
I'm assuming that max is 3.3 (I just bought 9 of this sensors and some are reporting 3.23) and for low I set it at 1.8 but I really don't know what is lowest voltage on which this sensors work.
My sensors reportet at maximum 3,34V and lowest voltage reported so far was 0.44 V. This low voltage was probably measured while trasmitting data.
Hi, First of all my biggest thanks go out to everybody making this piece of my homeautomation possible! I admire the motivation to write these scripts but also the story of the guy behind the ATC firmware, amazing how you keep at it for a year :)
Here's my issue and I think I'm almost there: What I did so far: I flashed the thermometer with the ATC firmware, created a dummy temperature sensor, edited the sensors.ini and when I issue the command "python3 LYWSD03MMC.py -a --watchdogtimer 5 --devicelistfile sensors.ini --onlydevicelist --callback sendToDomoticz.py" I see correct readouts in the console. However, it seems on the domoticz end the data somehow gets mixed up since the temperature domoticz is showing is actually the battery power.
To make sure it is not somehow a domoticz bug I just send the same command that gets build in the sendToDomoticz.py script manually, which works fine: "DOMOTICZIP/json.htm?type=command¶m=udevice&idx=74&nvalue=0&svalue=18;30;&battery=100"
Someone knows what might be going on here? I'm sooo close to get this sensor working and plan on placing more :)
EDIT: The humidity shown in Domoticz is correct btw
Okay, after fiddling around a bit more I found the error. Maybe it's interesting for the next update: For some reason if I change the val_temp = sys.argv[5] to 5 (thought I go for the calibrated one) this error happens. If I set it back to the default value (so val_temp = sys.argv[3]) this issue does not happen.
Hi, When I type:
/usr/bin/python3 ~/domoticz/scripts/python/MiTemperature2/LYWSD03MMC.py -d A4:C1:... -r -b -c 1
I get this error probably after updating the LYWSD03MMC.py script two days ago:
File "/home/pi/domoticz/scripts/python/MiTemperature2/LYWSD03MMC.py", line 666 else ^ SyntaxError: invalid syntax
Hi mywildsoul,
thanks for reporting this. There was a missing colon from this pull request 112 I've fixed it. Please update again and it should work now. Please give short feedback.
Thanks a lot! Working perfect :)