maxime1992 / linak-2-mqtt

41 stars 8 forks source link

Possibility to add compatibility for hassio addons #1

Closed darkkatarsis closed 1 year ago

darkkatarsis commented 2 years ago

Is there a chance that in the future the project can be added to the home assistant via hassio / addons?

maxime1992 commented 2 years ago

Hello, that is very much my intent.

That said, I haven't been able to have access to the bluetooth correctly from the container launched by Home Assistant.

I've raised a question:

Unfortunately I haven't had any answer so far.

If you're familiar with HA add-on system and how I correctly ask HA to pass both of these flags when creating the container --privileged -v /var/run/dbus:/var/run/dbus please let me know :+1:. I believe I've got what I need for the --privileged but I've got no clue how to pass the /var/run/dbus volume :shrug:

Mosher23 commented 1 year ago

What is the status of HASS Add-on? Home Assistant now natively support Bluetooth.

maxime1992 commented 1 year ago

I'm not running my HA instance as the whole OS but just as a docker container and therefore it fits my workflow to have it only as a docker container. So I won't be digging any further in that topic by myself.

If someone from the community is willing to look into it and raise a PR, I'm willing to take a look though.

I've applied the help wanted label. But as I don't have intent to work on it myself, I'm going to close the issue.

If anyone is willing to take a look themselves, please reopen the issue or ping me

nerijus commented 11 months ago

I was able to pass bluetooth controller to my podman container by using --userns=keep-id, here's my full [Service] section of the systemd service file:

[Service]
Environment=PODMAN_SYSTEMD_UNIT=%n TZ=Europe/Vilnius WATCHDOG_USEC=5000000
Restart=on-failure
RestartSec=30
TimeoutStopSec=70
TimeoutStartSec=300
# note: this is using https://github.com/brianegge/home-assistant-sdnotify.
# If not using that, remove the `WatchdogSec` line  and change
# `--sdnotify=container` to `--sdnotify=conmon`.
#WatchdogSec=60
ExecStartPre=/bin/rm -f %t/%n.ctr-id
ExecStart=/usr/bin/podman run \
                          --userns=keep-id \
                          --cidfile=%t/%n.ctr-id \
                          --cgroups=no-conmon \
                          --rm \
                          --sdnotify=conmon \
                          --replace \
                          --detach \
                          --label "io.containers.autoupdate=registry" \
                          --name=homeassistant \
                          --volume=/opt/hass/hass:/config:Z \
                          --volume=/opt/hass/media:/media:Z \
                          --volume=/run/dbus:/run/dbus:ro \
                          --network=host \
                          ghcr.io/home-assistant/home-assistant:stable
ExecStop=/usr/bin/podman stop --ignore --cidfile=%t/%n.ctr-id
ExecStopPost=/usr/bin/podman rm -f --ignore --cidfile=%t/%n.ctr-id
Type=notify
NotifyAccess=all