[add-on] HassOS I2C Configurator

HassOS I2C Configurator

image
This project enables the Raspberry Pi I2C bus from an addon. You can connect an SDCard and up to two hard disks or USB drives, which are detected as sda or sdb, and they will all have I2C enabled when you click start.

About

This project is a part of my HassOS Configurator project. The goal of this add-on, similar to root apps on Android, is to make a mole-hill out of a mountain.

Installation

Within Home Assistant, click Supervisor-> Add-on Store → … button (in top left)-> Repositories. Add this repository.
Open your Home Assistant instance and show the add add-on repository dialog with a specific repository URL pre-filled.

Click “HassOS I2C Configurator”, then install.

Configuration

There is no configuration. This will enable I2C on mmcblk0p1, sda1, and sdb1

Operation

Hit the start button and observe the logs. When complete, reboot. This will place the files into the system. After this, reboot again to activate I2C. This takes two reboots. You may uninstall the Add-On when complete.

FAQ

It didn’t work
Did you disable Protection Mode, run the addon, then reboot the device twice or did you accidentally restart Home Assistant instead? You have to reboot twice.

It still didn’t work
Are you sure you rebooted? Maybe you restarted the supervisor instead? You have to reboot twice

it still didn’t work and I’m sure I rebooted twice
Ok, then perform a hard reboot and run it again, then post your logs.

It says nothing to do, i2c not found, right after reboot
Undo any changes you may have done previously, like re-comment the lines in the boot config, reboot and try again. The lines in the boot config are used to determine if the app needs to set up drivers and the config file.

19 Likes

Thanks for this! But, what should I see after doing this? I have several i2c devices connected to the pi but after running this I still don’t see any i2c devices under /dev or ha hardware info. Am I looking in the wrong place or am I missing something?

Thanks!

It looks like this.


Did you reboot? Power off and back on reboot.

1 Like

I did… but still no luck… I have noticed I am getting Under-voltage detected warnings. That could be a factor so I’ll look into that. I am also thinking of booting my pi up under Raspbian so I can use i2c-tools to make sure all is good on the hardware side. If you could add output of i2cdetect -r 1 command in the logs of your add on that would really be cool! Thanks for the screen shot!

You could always jump into the container. Disable Protection Mode on ssh then run
docker container ls
docker exec -it <container ID> bash
The container stays running for 99999 seconds for this reason.

But if you don’t see the devices, i2c tools won’t operate.

I’m off to bed now. I will check this again for proper operation tomorrow.

I had to hard-power-off twice, and it worked well.
Initial

First reboot

Second reboot

1 Like

I started fresh and re flashed my SD card to the Hassio 64 Bit Raspberry Pi 4 image and ran this add on. Everything looked good but even after 2 reboots and 1 shutdown I still don’t see any i2c in /dev. I know the hardware is good as I can see their IDs using i2cdetect when booting under Raspberry Pi OS. I so wanted this to work but I don’t even know what questions to ask at this point.

NoI2CInDev

Thanks for the developing this. I’ve followed the excellent guide Raspberry Pi 4, Home Assistant OS (5.5, dev version) on a SSD, and the Argon One M.2 Case (In Progress) by @FreelancerJ to the point of activating the fan. I’ve run the I2C Configurator and after a full shutdown and restart (a 1st reboot didn’t seem to be sufficient) it looks like that worked:


adding dtparam=i2c_vc=on to sda1 config.txt
adding dtparam=i2c_arm=on to sda1 config.txt
no sdb1 config found
no mmcblk0p1 config found
This Configurator did it’s job. You can uninstall and reboot now. This configurator only works once.

As I’m no Pi or Linux expert so this was an easy way to get I2C.

As for the Active Cooling addon, that’s working, the fan is on :grinning:. I was using the default temperature settings where the low is 90F, however I couldn’t get below 95F-98F so the fan was running continuously. I’m not familiar with Pi4 temperatures so just wondering if you have deliberately set a low threshold. The HassOS is only running at just over 1% CPU so not exactly taxed. Anyway after looking at the Pi forums I’ve upped the low (100F) and medium values and it works great with the fan coming on occasionally.

Really happy to be running HA from SSD on a Pi4 device in a professional looking case, all with active cooling.

1 Like

Disable Protection Mode on the SSH Addon and it should show up. That looks like a docker container with Protection Mode enabled. Addons must explicitly request a device, or have Protection Mode disabled to see devices in /dev/

1 Like

I saw the problem and I thought to myself, “Self, since you already have access to the files, why not just show them the files?”, then I thought to myself, “Hey, self, that’s a great idea”, then I though to myself, “Yeah, I know, self, you came up with it!”. This went on for a while. Long story short, you can now see the output of the ls command and a “Found i2c access!” message when successful.

Please update.

You no longer need to disable protection mode. I changed some settings and disabled App Armor. We went from this:


to this

Is this correct?
Shouldn‘t it be the I2C Configurator that has to be installed?

1 Like

Correct! I had a malfunction in the copy-pasta subsystem.

:slight_smile: That is great. Where can I get it?

1 Like

Not working on my RPi4 with Home Assistant OS 5.10. More than 10 reboots and still getting these logs:

[s6-init] making user provided files available at /var/run/s6/etc…exited 0.
[s6-init] ensuring user provided files have correct perms…exited 0.
[fix-attrs.d] applying ownership & permissions fixes…
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts…
[cont-init.d] done.
[services.d] starting services
[services.d] done.
ls: /dev/i2c-1: No such file or directory
I don’t see I2C.
i2c already configured on sda1
i2c already configured on sda1
no sdb1 config found
no mmcblk0p1 config found
This Configurator did it’s job. Perform a hard-power-off reboot now.
You will need to reboot twice total, once to place the files, and again to activate the I2C.

Hardware:
Rpi4
Argon ONE M.2
WD Green 120gb

Confirmed. It’s working on mine and I’m seeing the same logs. Let me check into it.

Fixed in 0.2. Please update.

1 Like

Nice, it’s working perfectly with “ArgonOne Active Cooling”

1 Like

thanks a lot for this utility. Unfortunately no luck on my rpi 4 - could this be because I’m booting from an SSD?

1 Like

Please check the logs and place them here. A common problem is that you need to reboot twice. Full, power-off, pull-the-plug, reboot.