forked from JsBergbau/MiTemperature2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsendToDomoticz.py
More file actions
executable file
·39 lines (33 loc) · 842 Bytes
/
Copy pathsendToDomoticz.py
File metadata and controls
executable file
·39 lines (33 loc) · 842 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/usr/bin/python3
import os
import re
import requests
import time
import sys
domoticzserver = "192.168.1.36"
idx_temp = "52"
#idx_temp = sys.argv[2] #uncomment this line for ATC Mode. You have to configure the sensorname to your domoticz idx, for details please see https://github.com/JsBergbau/MiTemperature2/issues/59
val_temp = sys.argv[3] # change to sys.argv[5] for calibrated
val_hum = sys.argv[4]
val_bat = sys.argv[6]
val_comfort = "0"
if float(val_hum) < 40:
val_comfort = "2"
elif float(val_hum) <= 70:
val_comfort = "1"
elif float(val_hum) > 70:
val_comfort = "3"
res = requests.get(
"http://"
+ domoticzserver
+ "/json.htm?type=command¶m=udevice&idx="
+ idx_temp
+ "&nvalue=0&svalue="
+ val_temp
+ ";"
+ val_hum
+ ";"
+ val_comfort
+ "&battery="
+ val_bat
)