Would be great if someone with a BLE Sniffer to also Reverse Eng this one: Aqualin Bluetooth Water Irrigation System
Could just create a really cheap automatic irrigation system…
Mi Flora reporting if water was needed and Aqualin watering automatically…
Today I use a solenoid valve that opens when gets power and closes when power is removed. For that I just use a normal Z-wave switch for the outlet. So when I get a low threshold value from the Miflora HA turns that switch on.
But the Aqualin is cheaper than the switch and valve was.
I’m trying to set up the plantgw on my rpi z w but I keep getting this:
[Errno 104] Connection reset by peer
could not read data from C4:7C:8D:65:B8:FF (Rihanna) with reason: Helper exited
[Errno 104] Connection reset by peer
Exception IOError: (32, 'Broken pipe') in <bound method Peripheral.__del__ of <bluepy.btle.Peripheral instance at 0xb654b788>> ignored
could not read data from C4:7C:8D:65:B8:FF (Rihanna) with reason: Helper exited
[Errno 104] Connection reset by peer
Exception IOError: (32, 'Broken pipe') in <bound method Peripheral.__del__ of <bluepy.btle.Peripheral instance at 0xb654bcd8>> ignored
could not read data from C4:7C:8D:65:B8:FF (Rihanna) with reason: Helper exited
When I try to do a ble scan i get the following:
root@raspberrypi:~/bluepy/bluepy# python3 blescan.py
Scanning for devices...
Traceback (most recent call last):
File "blescan.py", line 140, in <module>
main()
File "blescan.py", line 122, in main
devices = scanner.scan(arg.timeout)
File "/usr/local/lib/python3.5/dist-packages/bluepy/btle.py", line 679, in scan
self.start(passive=passive)
File "/usr/local/lib/python3.5/dist-packages/bluepy/btle.py", line 617, in start
self._mgmtCmd("le on")
File "/usr/local/lib/python3.5/dist-packages/bluepy/btle.py", line 272, in _mgmtCmd
rsp = self._waitResp('mgmt')
File "/usr/local/lib/python3.5/dist-packages/bluepy/btle.py", line 304, in _waitResp
raise BTLEException(BTLEException.INTERNAL_ERROR, "Helper exited")
bluepy.btle.BTLEException: Helper exited
I can however do a lescan:
pi@raspberrypi:~ $ sudo hcitool lescan
LE Scan ...
C4:7C:8D:65:B8:FF (unknown)
38:01:95:D4:07:93 (unknown)
C4:7C:8D:65:B8:FF Flower care
04:52:C7:B0:EB:23 (unknown)
What gives?
EDIT:
Reinstalled raspbian again and hciconfig -a actually works now.
Now I just get this:
root@plantgateway:~# plantgateway
[Errno 104] Connection reset by peer
[Errno 104] Connection reset by peer
could not read data from C4:7C:8D:65:B8:FF (Rihanna) with reason: Error from Bluetooth stack (comerr)
[Errno 104] Connection reset by peer
could not read data from C4:7C:8D:65:B8:FF (Rihanna) with reason: Error from Bluetooth stack (comerr)
[Errno 104] Connection reset by peer
could not read data from C4:7C:8D:65:B8:FF (Rihanna) with reason: Error from Bluetooth stack (comerr)
[Errno 104] Connection reset by peer
could not read data from C4:7C:8D:65:B8:FF (Rihanna) with reason: Error from Bluetooth stack (comerr)
could not read data from C4:7C:8D:65:B8:FF (Rihanna) with reason: Error from Bluetooth stack (comerr)
[Errno 104] Connection reset by peer
could not read data from C4:7C:8D:65:B8:FF (Rihanna) with reason: Error from Bluetooth stack (comerr)
Could not get data from 2sensor(s): Rihanna, otherplant.
it took about 4-5sek to spam the Notfication handle… and when i send the command Primary
i got
attr handle: 0x0001, end grp handle: 0x0009 uuid: 00001800-0000-1000-8000-00805f9b34fb
attr handle: 0x000c, end grp handle: 0x000f uuid: 00001801-0000-1000-8000-00805f9b34fb
attr handle: 0x0010, end grp handle: 0x0022 uuid: 0000fe95-0000-1000-8000-00805f9b34fb
attr handle: 0x0023, end grp handle: 0x0030 uuid: 0000fef5-0000-1000-8000-00805f9b34fb
attr handle: 0x0031, end grp handle: 0x0039 uuid: 00001204-0000-1000-8000-00805f9b34fb
attr handle: 0x003a, end grp handle: 0x0042 uuid: 00001206-0000-1000-8000-00805f9b34fb
i enabled the debugmode for the MiFlora sensor and it post this errors in the log:
2017-10-10 11:13:25 DEBUG (SyncWorker_0) [homeassistant.components.sensor.miflora] Polling data for Pflanze1 Moisture
2017-10-10 11:13:25 INFO (SyncWorker_0) [homeassistant.components.sensor.miflora] Polling error [Errno Could not read data from Mi Flora sensor %s] xx:xx:xx:xx
2017-10-10 11:13:25 DEBUG (SyncWorker_9) [homeassistant.components.sensor.miflora] Polling data for Pflanze1 Conductivity
2017-10-10 11:13:25 INFO (SyncWorker_9) [homeassistant.components.sensor.miflora] Polling error [Errno Could not read data from Mi Flora sensor %s] xx:xx:xx:xx:xx
2017-10-10 11:13:25 DEBUG (SyncWorker_11) [homeassistant.components.sensor.miflora] Polling data for Pflanze1 Light intensity
2017-10-10 11:13:25 INFO (SyncWorker_11) [homeassistant.components.sensor.miflora] Polling error [Errno Could not read data from Mi Flora sensor %s] xx:xx
2017-10-10 11:13:25 DEBUG (SyncWorker_5) [homeassistant.components.sensor.miflora] Polling data for Pflanze1 Temperature
2017-10-10 11:13:25 INFO (SyncWorker_5) [homeassistant.components.sensor.miflora] Polling error [Errno Could not read data from Mi Flora sensor %s] xx:xx:xx:xx:xx
2017-10-10 11:13:25 DEBUG (SyncWorker_13) [homeassistant.components.sensor.miflora] Polling data for Pflanze1 Battery
2017-10-10 11:13:35 WARNING (MainThread) [homeassistant.helpers.entity] Update of sensor.pflanze1_battery is taking over 10 seconds
2017-10-10 11:13:35 DEBUG (SyncWorker_13) [homeassistant.components.sensor.miflora] Pflanze1 Battery = 0
2017-10-10 11:13:35 DEBUG (SyncWorker_13) [homeassistant.components.sensor.miflora] Data collected: [0, 0, 0, 0]
2017-10-10 11:13:35 DEBUG (SyncWorker_13) [homeassistant.components.sensor.miflora] Median is: 0
so any one an idea how i could fix that?
thanks budys =)
I’ve been using MiFlora component with 5 sensors. They worked more or less ok before. After upgrading my RPi3 to Stretch and Python 3.5 since HASS 0.55.x, the component doesn’t update sensors which are not close enough to the RPi3 (literally 1-2 meeters). I use integrated bt module on RPi3.
Then the easiest way to get gatttool would be to download the package, unpack it (it’s just a gzipped archive containing two more archives) and copy gatttool from there to /usr/bin
plus I would file a bug report that gatttool is not being installed when installing the bluez package, because if the maintainer doesn’t know, he can’t fix it.
edit: the linked package is for ARM hard float (suitable for e.g. raspis)
You could get a better BT adapter for the raspberry pi. Or you could get yourself a pi zero w, plug it in close to the outside wall and load it up with this: