Just wanted to share this techcode7821332.wordpress.com/2019/01/09/bredbandskollen-custom-component-for-homeassistant/
What version of CLI should you download for a Pi?
Go for https://frontend.bredbandskollen.se/download/bbk_cli_linux_amd64-1.0
Or https://frontend.bredbandskollen.se/download/bbk-cli_1.0.0_amd64.deb
Thank you.
I have this:
And when I check configuration I get:
Configuration invalid
Platform error sensor.bredbandskollen - Integration âbredbandskollenâ not found.
I have updated the guide so itâs upd to speed with new layout of custom_component
Doesnât make any difference.
I first just created a new file and named in init and that didnât work. Then I copied one from another custom component and deleted itâs contents. Still the same.
HoweverâŚ
If I change the name of the folder to âbredbandskollenâ and the file name to sensor.py the config is valid. But I donât get any new sensors.
I have now got to this stage:
Log Details (ERROR)
Logger: custom_components.bredbandskollen.sensor
Source: custom_components/bredbandskollen/sensor.py:68
Integration: bredbandskollen
First occurred: 10:52:37 AM (1 occurrences)
Last logged: 10:52:37 AM127 /bin/sh: /local/bbk_cli_linux_amd64-1.0: not found
and
Log Details (ERROR)
Logger: homeassistant.components.sensor
Source: custom_components/bredbandskollen/sensor.py:46
Integration: Sensor (documentation, issues)
First occurred: 10:52:37 AM (1 occurrences)
Last logged: 10:52:37 AMError while setting up bredbandskollen platform for sensor
Traceback (most recent call last): File â/usr/src/homeassistant/homeassistant/helpers/entity_platform.pyâ, line 178, in _async_setup_platform await asyncio.wait_for(asyncio.shield(task), SLOW_SETUP_MAX_WAIT) File â/usr/local/lib/python3.7/asyncio/tasks.pyâ, line 442, in wait_for return fut.result() File â/config/custom_components/bredbandskollen/sensor.pyâ, line 68, in async_setup_platform await data.async_update() File â/config/custom_components/bredbandskollen/sensor.pyâ, line 46, in async_update self.data = data.split(â ') AttributeError: âNoneTypeâ object has no attribute âsplitâ
One is probably causing the other. But what is a good place for the file so that it can be found.
I tried the path both with â/local/â and âlocal/â none of them worked.
If you run /local/bbk_cli_linux_amd64-1.0
in commandline, does that work?
Seems hass is unable to find that file
I donât know how to do that.
Iâm guessing you run hassio, that is not the way Iâm running my setup so I have a hard time helping with this
Ok. Thanks anyways
For anyone running hassio in docker and having a problem like this in the future.
The reason to why the bbk cli file canât be found is that itâs compiled with gcc while hassio uses another compilation library called musl. This because hassio runs in Alpine Linux. To solve this you have to get the source code from the website (https://github.com/dotse/bbk) and compile it in a Linux installation that uses musl. I compiled it inside the homeassistant docker:
First ssh into the system running the docker. Then use:
docker exec -it docker_id /bin/sh
git clone https://github.com/dotse/bbk.git
cd bbk/src/cli
make
When the make command is done youâll see the cli file inside the same folder and this should now be able to be found and ran.
I like that you are 5 days ahead of me. found both this post and the post about engine.h. but i canât get this to work any way. it runs fine if i log in to the docker image. but not when using the custom component. did you change something else?
for reference i needed to create two additional files to get this to work
__init__.py
"""The Mobile App integration."""
manifest.json
{
"domain": "bredbandskollen",
"name": "Bredbandskollen",
"documentation": "https://techcode7821332.wordpress.com/2019/01/09/bredbandskollen-custom-component-for-homeassistant/",
"dependencies": [],
"codeowners": [],
"requirements": []
}
for references if some one else is looking for this, the issue was that i had put in path: "/config/deps/bbk_cli"
and not path: /config/deps/bbk_cli
configuration.yaml
sensor:
- platform: bredbandskollen
path: /config/deps/bbk_cli
and yet another thing. when compiling the bbk_cli on alipine i got another format
alpine:
128.049 129.144 10.2325 gbg2.bredbandskollen.se Bredband2 AB gbg20264cdb4
normally with downloaded binaries
10.34 127.858 129.215 gbg2029828e7
so i needed to modify the MAPPING in sensor.py
MAPPING = {
'latency': 3,
'download': 1,
'upload': 2
}
Wow. Sorry for the late reply, but great that you managed to fix it yourself!
I will update the posts as soon as I have some spare time
i started working on a custom_component for hacs but failed and donât have more time to put on thisâŚ
if someone wants to continue the code is here https://github.com/benganellison/bredbandskollen_custom_component_ha
update: it was a typo, think it works now