Open k0nstantin1 opened 6 years ago
I don't know if you are still having this issue, but I stumbled upon it since I was writing a similar script to poll for the temperature of some Mija sensors. However, do you have a server running on 127.0.0.1 to accept your request? The error message indicates that you have not.
So two possible solutions to this: 1) Run a webserver and change the IP 2) Remove or comment the line that calls the server request (line 88): domoticzrequest("http://" + domoticzserver + "/json.htm?type=command¶m=udevice&idx=" + idx_temp + "&nvalue=0&svalue=" + val_temp + ";" + val_hum + ";"+ val_comfort + "&battery=" + val_bat)
That should "solve" the problem. HTH
Dear Developer,
I have aslo problem with script
I have miflora also and works well I use pi Zero w
Script can ask data from MItemp:
1: updating Mi Sensor: 4C:65:A8:DC:53:82 Firmware: 00.00.66 Name: MJ_HT_V1 Temperature: 23.6°C Humidity: 61.3% Battery: 100%
I put updatate line this:
print("\n1: updating") update("4C:65:A8:DC:53:82","35")
but idx 35 dummy sensor do not show temperature value and also I do not kow how can ask humidity value
Hello! Thanks for the script!
Can you help with solving the problem? When I run the script, the sensor gives the correct data, and then errors appear.
Can you help me figure out what the problem is?
P.S. The script miflora works without any problems..
1: updating Mi Sensor: 4C:65:A8:DD:66:33 Firmware: 00.00.66 Name: MJ_HT_V1 Temperature: 24.0°C Humidity: 39.7% Battery: 90% http://127.0.0.1:8000/json.htm?type=command¶m=udevice&idx=41&nvalue=0&svalue=24.0;39.7;2&battery=90 Traceback (most recent call last): File "/usr/lib/python3.5/urllib/request.py", line 1254, in do_open h.request(req.get_method(), req.selector, req.data, headers) File "/usr/lib/python3.5/http/client.py", line 1107, in request self._send_request(method, url, body, headers) File "/usr/lib/python3.5/http/client.py", line 1152, in _send_request self.endheaders(body) File "/usr/lib/python3.5/http/client.py", line 1103, in endheaders self._send_output(message_body) File "/usr/lib/python3.5/http/client.py", line 934, in _send_output self.send(msg) File "/usr/lib/python3.5/http/client.py", line 877, in send self.connect() File "/usr/lib/python3.5/http/client.py", line 849, in connect (self.host,self.port), self.timeout, self.source_address) File "/usr/lib/python3.5/socket.py", line 712, in create_connection raise err File "/usr/lib/python3.5/socket.py", line 703, in create_connection sock.connect(sa) ConnectionRefusedError: [Errno 111] Connection refused
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "domoticz_mijia.py", line 92, in
update("4C:65:A8:DD:66:33","41")
File "domoticz_mijia.py", line 88, in update
domoticzrequest("http://" + domoticzserver + "/json.htm?type=command¶m=udevice&idx=" + idx_temp + "&nval ue=0&svalue=" + val_temp + ";" + val_hum + ";"+ val_comfort + "&battery=" + val_bat)
File "domoticz_mijia.py", line 29, in domoticzrequest
response = urllib.request.urlopen(request)
File "/usr/lib/python3.5/urllib/request.py", line 163, in urlopen
return opener.open(url, data, timeout)
File "/usr/lib/python3.5/urllib/request.py", line 466, in open
response = self._open(req, data)
File "/usr/lib/python3.5/urllib/request.py", line 484, in _open
'_open', req)
File "/usr/lib/python3.5/urllib/request.py", line 444, in _call_chain
result = func(*args)
File "/usr/lib/python3.5/urllib/request.py", line 1282, in http_open
return self.do_open(http.client.HTTPConnection, req)
File "/usr/lib/python3.5/urllib/request.py", line 1256, in do_open
raise URLError(err)
urllib.error.URLError: <urlopen error [Errno 111] Connection refused>