Closed adrian-ludwig closed 6 years ago
Add this into that (at the end): https://github.com/home-assistant/hassio-build/blob/master/homeassistant/base/Dockerfile
Sorry @pvizeli ! I did not explain myself clearly: The snippet I have here does not work in the end.. Still needs some deps to work. I'm out of ideas what to do next with it.
It look like sed -ie 's/boost_python-py34/boost_python-py36/' setup.py
it not Support python 3.6. I think that need fix on gattlib
apk update
wget -q -O /etc/apk/keys/sgerrand.rsa.pub https://raw.githubusercontent.com/sgerrand/alpine-pkg-glibc/master/sgerrand.rsa.pub
wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.25-r0/glibc-2.25-r0.apk
apk add glibc-2.25-r0.apk
apk add bluez-dev boost-dev glib-dev g++
apk add python3-dev
pip3 download gattlib
tar xvzf ./gattlib-0.20150805.tar.gz
cd gattlib-0.20150805/
sed -ie 's/boost_python-py34/boost_python3/' setup.py
sed -ie 's/boost_thread/boost_thread-mt/' setup.py
pip3 install .
This fixes problem with installation of gattlib.
The only thing left is missing gatttool
There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.
Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment :+1:
Hey @adrian-ludwig,
does this still exist in the current hassio version?
If you're using Alpine: gatttool seems to be available as part of the bluez-deprecated package: https://pkgs.alpinelinux.org/contents?file=gatttool&path=&name=&branch=&repo=&arch=
I migrated from the AIO to Hass.io today and experience the same problem with the MiFlora BLE sensor. So I can confirm that the problem persits.
looks like a duplicate of https://github.com/home-assistant/home-assistant/issues/3458 which will be fixed in the next release of hassio
The problem still exists in 0.61.1. I think there referenced issue if just for gattool which was added.
Hey @escoand ,
the point of the ticket was that gatttool was missing and that was fixed. So what exactly is the problem you're having? Can you please provide a description/error message?
As the initial comment stated it is not possible to install gattlib out of the box. There are some packages missing and the installation (exactly compilation) of gattlib on the RPi3 lasts nearly hours...
Maybe this has to be an issue at hass.io
Sorry I dont understand your problem. Gatttool is installed by default with hass.io version 61. It is installed from the alpine package repo. So you do not have to compile it.
And with haas 61 miflora is uaing bluepy instead of gatttol. So either way, the problem should be resolved.
So I'm a bit confused that you still have a problem there. Can you please post an error message of what is going wrong?
Ok, the point seems to be that the issue creator wants to use miflora and I try to use bluetooth_le.
Should I create a separate issue for the bluetooth_le and gattlib problem?
@escoand , yes please create a separate issue.
Assuming that you're talking about the Bluetooth LE device tracker, I just checked the code and it's using the gattlib library, which I'm not familiar with. Also, the solution is probably a different one than for the miflora component.
getting the following error on the latest hassio (0.62.0):
2018-01-29 21:16:34 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.ficus_wohnzimmer_conductivity fails
Traceback (most recent call last):
File "/usr/lib/python3.6/site-packages/homeassistant/helpers/entity.py", line 201, in async_update_ha_state
yield from self.async_device_update()
File "/usr/lib/python3.6/site-packages/homeassistant/helpers/entity.py", line 308, in async_device_update
yield from self.hass.async_add_job(self.update)
File "/usr/lib/python3.6/asyncio/futures.py", line 332, in __iter__
yield self # This tells Task to wait for completion.
File "/usr/lib/python3.6/asyncio/tasks.py", line 250, in _wakeup
future.result()
File "/usr/lib/python3.6/asyncio/futures.py", line 245, in result
raise self._exception
File "/usr/lib/python3.6/concurrent/futures/thread.py", line 56, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/lib/python3.6/site-packages/homeassistant/components/sensor/miflora.py", line 143, in update
data = self.poller.parameter_value(self.parameter)
File "/usr/lib/python3.6/site-packages/miflora/miflora_poller.py", line 128, in parameter_value
self.fill_cache()
File "/usr/lib/python3.6/site-packages/miflora/miflora_poller.py", line 60, in fill_cache
firmware_version = self.firmware_version()
File "/usr/lib/python3.6/site-packages/miflora/miflora_poller.py", line 99, in firmware_version
with self._bt_interface.connect(self._mac) as connection:
File "/usr/lib/python3.6/site-packages/miflora/backends/__init__.py", line 40, in __enter__
self._bt_interface.backend.connect(self.mac)
File "/usr/lib/python3.6/site-packages/miflora/backends/bluepy.py", line 22, in connect
self._peripheral = Peripheral(mac, iface=iface)
File "/usr/lib/python3.6/site-packages/bluepy/btle.py", line 353, in __init__
self._connect(deviceAddr, addrType, iface)
File "/usr/lib/python3.6/site-packages/bluepy/btle.py", line 402, in _connect
"Failed to connect to peripheral %s, addr type: %s" % (addr, addrType))
bluepy.btle.BTLEException: Failed to connect to peripheral C4:7C:8D:..., addr type: public
@rockinglama This was already fixed: https://github.com/open-homeautomation/miflora/pull/80 Will be part of the next release of the miflora library.
This only happens when the Sensor has bad reception and/or is almost out of range of your bluetooth dongle.
This also breaks for me using hassio and 0.62.0 since the release that fixes it is not yet out should we consider rolling back to gatttool as a fix? Does that work under different environments?
I guess as a quick workaround, we could also just catch the bluepy.ble.BTLEException and the miflora.backends.BluetoothBackendException: https://github.com/home-assistant/home-assistant/blob/323992e224be72b9bd4af33a659eb95edee519d5/homeassistant/components/sensor/miflora.py#L144
If the connection to the device fails, there is not much that we can do, except trying again later. I did not have the time to check, if this really solves the problem...
After more investigation: The bug reported by @rockinglama is not yet fixed in the miflora library :cry:
I just opened a bug ticket there (probably for me to fix): https://github.com/open-homeautomation/miflora/issues/84
@rockinglama I got the same error in versions 0.62.0 and 0.62.1
Home Assistant release (
hass --version
): 0.51.2 - hass.ioPython release (
python3 --version
): 3.6Component/platform: Bluetooth / BT LE tracker / Mi Plant/Flora
Description of problem: /bin/sh: gatttool: not found Result: Bluetooth LE and Mi Flora are not working at all
gattlib
python package is not installing because of its dependencies toglib
Expected: gatttool to exists in system
Problem & Investigation The problem is
bluez
package on Alpine distribution do not have "utils" like hcitool or gatttool I was trying to fix it by building from source.. I ended up with this (or something similiar):But this is also not working due to requirements of header for
boost-python
andboost-thread
. But those packages are installed byboost-dev
- in different versions than required (that is my assumption). Alpine packages website reports that those packages should be included inboost-dev
.I have no idea what to do next..