@lolouk44 Just a small question about your docker container. I’m using multiple USB dongles with usb-cable extensions to cover to floors with bluetooth. Is it configurable, wich hci device is used by the container? Or does it simply scan with all bluetooth dongles?
At the moment it takes hci0 by default.
I’ve not yet looked at multiple devices yet but can’t see why it can’t be done…
Ah, okay, thanks for the information. Is it possible to make it configurable? That would it make possible for me to pick the Bluetooth dondle near to the scale.
Time is a bit of a luxury for me at the mo but I’ll look into it
Thanks a lot, that would be great!
Can you do me a favour and open a new issue on my repo?
I have made a change that I need your help with to test
Great, sure! That was really quick
I just opened an issue: https://github.com/lolouk44/xiaomi_mi_scale/issues/19
It will take a few days to test as I’m on a business trip right now.
You did not commit this change yet, did you?
No. I’ve made a change in my pc but did not commit anything yet.
I’ll try and create a beta branch for you
Great. Thanks
Thank you for this great script, just got it running on a Pi Zero W. Highly appreciated!
0.1.4 is out with the ability to select a specific hci device
Do I have any takers in testing an add-on?
I don’t run hass.io Home Assistant so can’t test…
https://github.com/lolouk44/xiaomi_mi_scale_ha_add_on
I’ll can do that!
I get the following error:
20-06-29 15:29:43 INFO (SyncWorker_15) [supervisor.docker.interface] Restart homeassistant/raspberrypi3-homeassistant
20-06-29 15:29:45 INFO (MainThread) [supervisor.api.proxy] Home Assistant WebSocket API error: Received message 8:1000 is not str
20-06-29 15:29:45 INFO (MainThread) [supervisor.api.proxy] Home Assistant WebSocket API connection is closed
20-06-29 15:30:25 INFO (MainThread) [supervisor.homeassistant] Updated Home Assistant API token
20-06-29 15:30:57 INFO (SyncWorker_7) [supervisor.docker.addon] Start build local/armv7-addon-xiaomi_mi_scale:0.7
20-06-29 15:30:57 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/aiohttp/web_protocol.py", line 418, in start
resp = await task
File "/usr/local/lib/python3.7/site-packages/aiohttp/web_app.py", line 458, in _handle
resp = await handler(request)
File "/usr/local/lib/python3.7/site-packages/aiohttp/web_middlewares.py", line 119, in impl
return await handler(request)
File "/usr/src/supervisor/supervisor/api/security.py", line 157, in token_validation
return await handler(request)
File "/usr/src/supervisor/supervisor/api/utils.py", line 61, in wrap_api
answer = await method(api, *args, **kwargs)
File "/usr/src/supervisor/supervisor/addons/__init__.py", line 151, in install
await addon.instance.install(store.version, store.image)
File "/usr/src/supervisor/supervisor/utils/__init__.py", line 31, in wrap_api
return await method(api, *args, **kwargs)
File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/src/supervisor/supervisor/docker/addon.py", line 377, in _install
self._build(tag)
File "/usr/src/supervisor/supervisor/docker/addon.py", line 391, in _build
use_config_proxy=False, **build_env.get_docker_args(tag)
File "/usr/local/lib/python3.7/site-packages/docker/models/images.py", line 279, in build
resp = self.client.api.build(**kwargs)
File "/usr/local/lib/python3.7/site-packages/docker/api/build.py", line 148, in build
raise TypeError("You must specify a directory to build in path")
TypeError: You must specify a directory to build in path
my config file:
ARG BUILD_FROM
FROM $BUILD_FROM
ENV LANG C.UTF-8
# adjust here the environment variables
ENV HCI_DEV hci0
ENV MISCALE_MAC xxxxx
ENV MQTT_PREFIX miScale
ENV MQTT_HOST xxxx
ENV MQTT_USERNAME xxxx
ENV MQTT_PASSWORD xxxx
ENV MQTT_PORT 1883
ENV TIME_INTERVAL 30
ENV USER1_GT 70
ENV USER1_SEX male
ENV USER1_NAME xxx
ENV USER1_HEIGHT xxxx
ENV USER1_DOB xxxx
ENV USER2_LT 35
ENV USER2_SEX female
ENV USER2_NAME Serena
ENV USER2_HEIGHT 95
ENV USER2_DOB 1990-01-01
ENV USER3_SEX female
ENV USER3_NAME Missy
ENV USER3_HEIGHT 150
ENV USER3_DOB 1990-01-01
WORKDIR /opt/miscale
COPY src /opt/miscale
RUN apt-get update && apt-get install -y \
bluez \
python-pip \
libglib2.0-dev && \
rm -rf /var/lib/apt/lists/*
RUN pip install -r requirements.txt
# Copy in docker scripts to root of container...
COPY dockerscripts/ /
RUN chmod a+x /entrypoint.sh
RUN chmod a+x /cmd.sh
ENTRYPOINT ["/entrypoint.sh"]
CMD ["/cmd.sh"]
Thanks. I should have known it would not be so easy
I’ve got a spare Pi3 that I’ll use to install hass.io to test.
Also looking to use the options to use a pre-built docker image instead of a dockerfile that needs to be built.
Watch this space…
Hi @Brian_Mollegaard_Ped
Thanks for trying earlier on.
I think we’re now ready
I’ve installed hass.io on a spare Pi3
All appears to be working fine.
For now it’s a local build, so it takes a while to build and install
I’ll update the main script/docker so it can be used from the Add-On as well (so I only need to maintain 1 set of scripts )
Let me know if it works for you…
Sounds good!
I’ll test it out this evening!
Hi, nice work ! I’m using the script on a pi zero and run it with ./wrapper.sh. I get a permission denied error:
Bluetooth connection error: Failed to execute management command ‘le on’ (code: 20, error: Permission Denied)
How do I allow the pi user access to bluetooth ?
That’s probably insufficient permissions for bluepy-helper. Try the commands below, worked fine for me.
cd ~/.local/lib/python3.7/site-packages/bluepy
sudo setcap 'cap_net_raw,cap_net_admin+eip' bluepy-helper