Page 15 of 17
Re: Xiaomi Mi Flora [Temp/Light/Moisture] BLE Sensor
Posted: Wednesday 27 September 2017 18:23
by joostnl
I'm trying to install your script on my fresh Domoticz installation.
I followed the wiki, changed my domoticz server with username and password.
At the botom deleted all predifind sensor and added only my first sensor:
With the IDX numbers from the devices list and bluetooth adre.s
print("\n1: Anthurium (Anthurium)")
update("C4:7C:8D:65:CC:27","139","142","141","143")
When executing i get the following error:
1: Anthurium (Anthurium)
Mi Flora: C4:7C:8D:65:CC:27
Firmware: 2.7.0
Name: Flower care
Temperature: 26.9°C
Moisture: 7%
Light: 1995 lux
Fertility: 5 uS/cm?
Battery: 100%
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 694, in create_connection
for res in getaddrinfo(host, port, 0, SOCK_STREAM):
File "/usr/lib/python3.5/socket.py", line 733, in getaddrinfo
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -2] Name or service not known
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/pi/domoticz/scripts/python/miflora/domoticz.py", line 97, in <module>
update("C4:7C:8D:65:CC:27","139","142","141","143")
File "/home/pi/domoticz/scripts/python/miflora/domoticz.py", line 79, in update
domoticzrequest("http://" + domoticzserver + "/json.htm?type=command¶m=udevice&idx=" + idx_temp + "&nvalue=0&svalue=" + val_temp + "&battery=" + val_bat)
File "/home/pi/domoticz/scripts/python/miflora/domoticz.py", line 30, 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 -2] Name or service not known>
Can someone point me the good direction?
Could it be related to Python version 3.5? Wich version is recommend?
Re: Xiaomi Mi Flora [Temp/Light/Moisture] BLE Sensor
Posted: Saturday 07 October 2017 12:15
by DAVIZINHO
hello.
now i have this working fine, i follow the tutorial in wiki and is perfect!!!
But i have a question, the sensor i configure 4 info that the sensor send to domoticz:
- humidity
- fertility
- temperature
- lux
but i see that the script can send the battery status too?
what changes i need to do in the scripts to obtaint the battery status? (in the tutorial not say nothing
)
thanks!
Re: Xiaomi Mi Flora [Temp/Light/Moisture] BLE Sensor
Posted: Sunday 08 October 2017 17:53
by empreur76
hello,
we have a problems,
anyone can help me?
1: Capteur 3
Mi Flora: C4:7C:8D:62:X3:XX
Firmware: 3.1.4
Name: Flower care
Temperature: 15.9°C
Moisture: 11%
Light: 5907 lux
Fertility: 67 uS/cm?
Battery: 99%
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.py", line 98, in <module>
update("C4:7C:8D:62:X3:XX","50","52","53","51")
File "domoticz.py", line 78, in update
domoticzrequest("http://" + domoticzserver + "/json.htm?type=command¶m=udevice&idx=" + idx_temp + "&nvalue=0&svalue=" + val_temp + "&battery=" + val_bat)
File "domoticz.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>
thx
Re: Xiaomi Mi Flora [Temp/Light/Moisture] BLE Sensor
Posted: Sunday 08 October 2017 18:04
by joostnl
I have simular python issues...
I think it is related to my fresh Jessie, domoticz installation.
did you did a fresh install or update?
empreur76 wrote: ↑Sunday 08 October 2017 17:53
hello,
we have a problems,
anyone can help me?
1: Capteur 3
Mi Flora: C4:7C:8D:62:X3:XX
Firmware: 3.1.4
Name: Flower care
Temperature: 15.9°C
Moisture: 11%
Light: 5907 lux
Fertility: 67 uS/cm?
Battery: 99%
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:
thx
Re: Xiaomi Mi Flora [Temp/Light/Moisture] BLE Sensor
Posted: Sunday 08 October 2017 19:06
by tonbor
- Screenshot_20171008-185647-512x384resize.png (63.59 KiB) Viewed 6740 times
the battery status is shown in the normal domoticz way
Re: Xiaomi Mi Flora [Temp/Light/Moisture] BLE Sensor
Posted: Sunday 08 October 2017 19:17
by woody4165
Hi all. I'm trying to let Mi Flora work, but with no success. I have other BLE devices, Nut, working.
I get some errors, sometimes "device busy" other "no route to host". Any advice?
I'm on Domoticz latest beta and Bluez latest version.
Thanks
Re: Xiaomi Mi Flora [Temp/Light/Moisture] BLE Sensor
Posted: Sunday 08 October 2017 19:24
by empreur76
yes ,
a fresh install of jessie
quote=joostnl post_id=153288 time=1507478680 user_id=8817]
I have simular python issues...
I think it is related to my fresh Jessie, domoticz installation.
did you did a fresh install or update?
empreur76 wrote: ↑Sunday 08 October 2017 17:53
hello,
we have a problems,
anyone can help me?
1: Capteur 3
Mi Flora: C4:7C:8D:62:X3:XX
Firmware: 3.1.4
Name: Flower care
Temperature: 15.9°C
Moisture: 11%
Light: 5907 lux
Fertility: 67 uS/cm?
Battery: 99%
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:
thx
[/quote]
Re: Xiaomi Mi Flora [Temp/Light/Moisture] BLE Sensor
Posted: Sunday 08 October 2017 22:37
by joostnl
Can someone post a jessie image with domoticz and python with bluez installed? (I got raspberry on 2b) I think If you start fresh and follow the wiki it not going to work. I think it is related to latest jessie or python.. I spend hours retrying but no luck
empreur76 wrote: ↑Sunday 08 October 2017 19:24
yes ,
a fresh install of jessie
quote=joostnl post_id=153288 time=1507478680 user_id=8817]
I have simular python issues...
I think it is related to my fresh Jessie, domoticz installation.
did you did a fresh install or update?
empreur76 wrote: ↑Sunday 08 October 2017 17:53
hello,
we have a problems,
anyone can help me?
1: Capteur 3
Mi Flora: C4:7C:8D:62:X3:XX
Firmware: 3.1.4
Name: Flower care
Temperature: 15.9°C
Moisture: 11%
Light: 5907 lux
Fertility: 67 uS/cm?
Battery: 99%
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:
thx
[/quote]
Re: Xiaomi Mi Flora [Temp/Light/Moisture] BLE Sensor
Posted: Monday 09 October 2017 17:47
by empreur76
hello,
we have change my Raspberry ip to 127.0.0.1 into the script and all it's ok for me.
Re: Xiaomi Mi Flora [Temp/Light/Moisture] BLE Sensor
Posted: Monday 09 October 2017 19:16
by IDANIT
RaspberryPi 3, Raspbian Stretch.
I follow the wiki, all installation, coping, making etc went fine, but I stuck on "Finding the sensor's Bluetooth Address". Got this error messages:
Code: Select all
pi@raspberrypi:~/bluez-5.44 $ sudo tools/btmgmt le on
Set Low Energy for hci0 failed with status 0x11 (Invalid Index)
Can anyone help me please?
Re: Xiaomi Mi Flora [Temp/Light/Moisture] BLE Sensor
Posted: Monday 09 October 2017 20:08
by remb0
I see that the original github code is forked many times (with improvements) maybe it's handy to check if the forks are better?
Re: Xiaomi Mi Flora [Temp/Light/Moisture] BLE Sensor
Posted: Monday 09 October 2017 20:35
by woody4165
I saw too that a day ago there were some improvements on github.
I've tried to understand where are the changes and where to help make to change here, but I'm not an expert coder.
I saw that there is an index.js with this description, "Fixing the odd value reading."
If I can be any help let me know.
Thanks
Re: Xiaomi Mi Flora [Temp/Light/Moisture] BLE Sensor
Posted: Thursday 12 October 2017 20:53
by IDANIT
IDANIT wrote: ↑Monday 09 October 2017 19:16
RaspberryPi 3, Raspbian Stretch.
I follow the wiki, all installation, coping, making etc went fine, but I stuck on "Finding the sensor's Bluetooth Address". Got this error messages:
Code: Select all
pi@raspberrypi:~/bluez-5.44 $ sudo tools/btmgmt le on
Set Low Energy for hci0 failed with status 0x11 (Invalid Index)
Can anyone help me please?
really no one has such error?
Re: Xiaomi Mi Flora [Temp/Light/Moisture] BLE Sensor
Posted: Monday 16 October 2017 22:55
by joostnl
empreur76 wrote: ↑Monday 09 October 2017 17:47
hello,
we have change my Raspberry ip to 127.0.0.1 into the script and all it's ok for me.
Thank you! Changing my ip to the script, WITHOUT http:// did the trick.
So at ip: 192.168.2.13 (for me my domoticz ip)
I only get this warnings sometimes:
~/bluez-5.44 $ connect error: Transport endpoint is not connected (107)
/bluez-5.44 $ sudo hcitool lescan Set scan parameters failed: Input/output error
But after:
pi@raspberrypi:~/bluez-5.44 $ sudo hciconfig hci0 down
pi@raspberrypi:~/bluez-5.44 $ sudo hciconfig hci0 up
Everything is working again, more people with this issue?
Re: Xiaomi Mi Flora [Temp/Light/Moisture] BLE Sensor
Posted: Tuesday 17 October 2017 10:21
by martijnm
I have three MiFlora Plant Sensors, which are working fine with this script. I'm thinking about ordering the RoPot as well, is this device supported by the script?
Re: Xiaomi Mi Flora [Temp/Light/Moisture] BLE Sensor
Posted: Monday 25 December 2017 8:56
by EBOOZ
I got my first Mi Flora yesterday and thanks to the Wiki, installation went (almost) flaweless!
My dummy sensor for logging moisture didn't update to the correct value (was always 0), and when I looked in the domoticz.py script, I noticed the URL was formatted incorrect. I modified the script so it also supports changing the status to Normal, Dry or Wet. Reading through the previous pages I assumed 20 is the right trigger for setting the status to Dry.
Original code:
Code: Select all
# Update moisture
val_moist = "{}".format(poller.parameter_value(MI_MOISTURE))
domoticzrequest("http://" + domoticzserver + "/json.htm?type=command¶m=udevice&idx=" + idx_moist + "&svalue=" + val_moist + "&battery=" + val_bat)
Modified to (where svalue 3 is Wet and svalue 2 is Dry):
Code: Select all
# Update moisture
val_moist = "{}".format(poller.parameter_value(MI_MOISTURE))
if int(val_moist) >= 60:
domoticzrequest("http://" + domoticzserver + "/json.htm?type=command¶m=udevice&idx=" + idx_moist + "&nvalue=" + val_moist + "&svalue=3")
elif int(val_moist) <= 20:
domoticzrequest("http://" + domoticzserver + "/json.htm?type=command¶m=udevice&idx=" + idx_moist + "&nvalue=" + val_moist + "&svalue=2")
else:
domoticzrequest("http://" + domoticzserver + "/json.htm?type=command¶m=udevice&idx=" + idx_moist + "&nvalue=" + val_moist + "&svalue=0")
Re: Xiaomi Mi Flora [Temp/Light/Moisture] BLE Sensor
Posted: Sunday 14 January 2018 1:12
by lolomin
Hi,
Trying to use MI Flora/Flower Care with Domoticz, devices are OK/detecte under Domoticz but problem is more with this Bluetooth connection/distance from my Linux PC and the Mi Flora ... (same problem from the phone with FlowerCare application if I'm too far from the Mi Flora).
I'm also owning a XIaomi Gateway with door sensors, ceiling lamp and my interrogation is : MiFlora/Flower Care is displayed/detected under Mi Home application and I was wondering if it was possible to grab all values from MiFlora though the Xiaomi Gataway like it is possible for Door Sensors, ceiling lamp ... etc ... My Xiaomi Gateway is in the same room as my Mi Flora.
Thanks for your suggestions.
Regards,
Laurent
Re: Xiaomi Mi Flora [Temp/Light/Moisture] BLE Sensor
Posted: Sunday 14 January 2018 7:37
by joostnl
This would be great
lolomin wrote: ↑Sunday 14 January 2018 1:12
Hi,
Trying to use MI Flora/Flower Care with Domoticz, devices are OK/detecte under Domoticz but problem is more with this Bluetooth connection/distance from my Linux PC and the Mi Flora ... (same problem from the phone with FlowerCare application if I'm too far from the Mi Flora).
I'm also owning a XIaomi Gateway with door sensors, ceiling lamp and my interrogation is : MiFlora/Flower Care is displayed/detected under Mi Home application and I was wondering if it was possible to grab all values from MiFlora though the Xiaomi Gataway like it is possible for Door Sensors, ceiling lamp ... etc ... My Xiaomi Gateway is in the same room as my Mi Flora.
Thanks for your suggestions.
Regards,
Laurent
Re: Xiaomi Mi Flora [Temp/Light/Moisture] BLE Sensor
Posted: Sunday 14 January 2018 8:05
by Spitfire
joostnl wrote: ↑Sunday 14 January 2018 7:37
This would be great
lolomin wrote: ↑Sunday 14 January 2018 1:12
Hi,
Trying to use MI Flora/Flower Care with Domoticz, devices are OK/detecte under Domoticz but problem is more with this Bluetooth connection/distance from my Linux PC and the Mi Flora ... (same problem from the phone with FlowerCare application if I'm too far from the Mi Flora).
I'm also owning a XIaomi Gateway with door sensors, ceiling lamp and my interrogation is : MiFlora/Flower Care is displayed/detected under Mi Home application and I was wondering if it was possible to grab all values from MiFlora though the Xiaomi Gataway like it is possible for Door Sensors, ceiling lamp ... etc ... My Xiaomi Gateway is in the same room as my Mi Flora.
Thanks for your suggestions.
Regards,
Laurent
The present Xiaomi Gateway does not handle Bluetooth so it is not possible. The reason you see the Flower sensors in the Xiaomi app is because your phone or pad has a direct connection to it (try turning off BT and you will find out).
However I heard there was a new Xiaomi Gateway coming supporting BT so maybe with that one.
Re: Xiaomi Mi Flora [Temp/Light/Moisture] BLE Sensor
Posted: Sunday 14 January 2018 19:45
by lolomin
Spitfire wrote: ↑Sunday 14 January 2018 8:05
joostnl wrote: ↑Sunday 14 January 2018 7:37
This would be great
lolomin wrote: ↑Sunday 14 January 2018 1:12
Hi,
Trying to use MI Flora/Flower Care with Domoticz, devices are OK/detecte under Domoticz but problem is more with this Bluetooth connection/distance from my Linux PC and the Mi Flora ... (same problem from the phone with FlowerCare application if I'm too far from the Mi Flora).
I'm also owning a XIaomi Gateway with door sensors, ceiling lamp and my interrogation is : MiFlora/Flower Care is displayed/detected under Mi Home application and I was wondering if it was possible to grab all values from MiFlora though the Xiaomi Gataway like it is possible for Door Sensors, ceiling lamp ... etc ... My Xiaomi Gateway is in the same room as my Mi Flora.
Thanks for your suggestions.
Regards,
Laurent
The present Xiaomi Gateway does not handle Bluetooth so it is not possible. The reason you see the Flower sensors in the Xiaomi app is because your phone or pad has a direct connection to it (try turning off BT and you will find out).
However I heard there was a new Xiaomi Gateway coming supporting BT so maybe with that one.
Hi,
Thanks for this answer, this is a good reason why it can't be working for the moment
Regards,
lolo