Closed darmach closed 2 years ago
Hi @darmach,
I'm not used to HAOS (using a core install) but your issue is definitively related to access rights to the i2c bus within the container running HA, cfr. L188 (and ssh). A few questions:
pi@RPiv4:~ $ grep i2c /boot/config.txt
dtparam=i2c_arm=on
pi@RPiv4:~ $ lsmod | grep i2c
i2c_bcm2835 16384 2
i2c_dev 20480 4
I can give a try to HAOS using a spare RPi4B or a QEMU machine but not before next week.
Thanks for the response @jpcornil-git !
I enabled it manually, logging on physical console as root to get the access to /mnt/boot
In config.txt I enabled only i2c_arm - I wanted to get only the i2c-1 header active, the one (I hope I found that right) next to 5V and GND pins.
I can see i2c modules loaded:
[core-ssh ~]$ lsmod | grep i2c
i2c_dev 20480 8
i2c_bcm2835 16384 4
(Hmm, but that's a suspiciously high device count for Rpi3, right? 8 and 4?)
Also the device is visible in /dev:
[core-ssh ~]$ ls -l /dev/ | grep i2c
crw-rw-rw- 1 root root 89, 1 Oct 12 17:24 i2c-1
No hurry at all, if you could find some time next week to test this it would be awesome!
Hi @jpcornil-git, I tested this a bit today, ran a --privileged
ubuntu container on the side, and was able to i2cdetect
the addres without problem.
Looks like the root cause is HA container privilege separation, can we somehow safely (or not) work around it while still using HASSOS? Else I will have to think about migration to Some Rpi linux distribution and running HA on top of that...
Note that I see here that dtparam=i2c1=on and dtparam=i2c_arm=on should be added to config.txt
From what I can see HA OS supervisor is running homeassistant container in privileged mode already, cfr. https://github.com/home-assistant/supervisor/blob/main/supervisor/docker/homeassistant.py#L133 => likely only a matter of enabling i2c in HA OS as described above
Hi, I have HA OS installed on Rpi3B, and MCP23017 connected to i2c-1 bus (if I didn't mix something up - connected data pins to those right next to 5V and GND on Rpi3B GPIO)
With HA-mcp23017 installed via HACS I do get errors below in the logs:
Tried to test this with apk installed i2c-tools:
I suspect I don't have access to this device because of container separation (this was executed in HA ssh, so in ssh addon container I guess?)
Can you advise what I might be doing wrong?