WTH why enabling I2C is so hard?

There are countless issues about trouble with enabling I2C, for example:

Importing setting via USB isn’t working. I get no errors, no success message (as many other users)

Please consider adding a way to easily configure hardware, via CLI or using the new snapshot of OS settings or via UI
Many of us need this, for sensors or I2C controlled fan or I2C relays.

Agreed, spent many hours trying to get this to work but have done it a few times now so have it pretty figured out. Maybe the documentation just needs to be updated?

My experiences may be different but I found that that I had to use import from USB to load the modules but it didn’t seem to add lines to the config.txt so I have to add them manually by putting the SD card into a windows PC. Have also found that if I have i2c and UART enabled home assistant won’t boot unless I also disable Bluetooth.

Also when importing from USB it was difficult to know if it was successful. By refreshing the logs I could see that it had done it but a confirmation pop up might be a good addition.

1 Like

I don’t like idea to use import from USB and manually editing files on SD card.
The whole idea behind “Import from USB” should be to import all settings, but this isn’t working (you still need manual steps).

I use Pi3 and Pi4, so I can only say about my experience on those two, not sure about the rest of the supported hardware.

Yes, a confirmation dialog would be a nice addition :slight_smile:

I think the problem might be in the directory structure of the USB. In the documentation it tells you to put the config.txt edits in the root of the USB but I think I read somewhere else, but can’t find it now, that the config.txt needs to be in a folder such as /boot or similar.

Not sure what might be the problem. For some users this works ok, some have a lot of problems (https://github.com/Misiu/argon40/issues/4)
Maybe the files must be put in the correct folders, maybe the file encoding is the problem.

I just found one very interesting thing.
According to this comment we must create folder called /modules (with a slash at the beginning).
Problem is that on windows this isn’t possible.
Can this be changed? So both /modules and modules would work?

If this is the reason why importing config from USB isn’t working (for Windows users) then this would solve the problem once and for all.

A directory called /modules just means create a directory called modules in the root directory of the drive. The language in the documentation is a bit double defined as it says to create it in the root directory.

In windows terminology assuming your USB drive appears as D: it would be a directory called D:\modules

I’ve tried enabling I2C via Import from USB and I had no success.
Many users of my integration and of this forum have exact same problem.
There is no error message, no success message.

I had this challenge with directory name started with “/”.
Not possible to do with Windows I have tried different names and no success.
Finally I use Mac laptop where such name is possible and it worked from the first try.
Also was readonig that it is possible to make in Linux - no experience…

Thank you for confirming.
This is frustrating that this doesn’t work on windows :confused:

The / in /modules only stands for the root of the drive. / is the path separator in Linux and cannot be part of a directory name.

That being said, the description really does not work as is today. I am working on fixing this.

1 Like

I’m willing to try the changes on fresh systems on Pi3 and Pi4.
Please let me know when you have something ready.

@Misiu the new documentation is now public: https://www.home-assistant.io/hassio/enable_i2c/. I did test it on a RPi 4, more feedback/testing welcome :slight_smile:

In the first part there is a ling to enable I2C using USB stick.
Problem is that I get page not found when trying to navigate.

https://github.com/home-assistant/operating-system/blob/a2a4cf8668c3c333b4641da264d5eed18a786179/Documentation/boards/raspberrypi.md#i2c

Could you please take a look at this?

I just noticed one thing.
The link in the docs has hassio in it. Shouldn’t that be changed to hassos?
Not sure if this is a bug and where should I report that?

@agners do you think there should be another section about 1-Wire there? Now configuration (description of how to enable it) is part of integration description - https://www.home-assistant.io/integrations/onewire/#raspberry-pi-set-up
Having a page https://www.home-assistant.io/hassio/enable_1wire/ would make things consistent.

Hm, I think we should remove that link, its basically the same information again in a different format.

1-Wire: Yeah would be nice I guess. There is a whole slew of embedded interfaces which could be described I guess…

The docs in the repo (https://github.com/home-assistant/operating-system/blob/a2a4cf8668c3c333b4641da264d5eed18a786179/Documentation/boards/raspberrypi/README.md#i2c) mention usb stick method, which isn’t supported right now, so it should be removed in both places (docs you recently changed and on github).

1-Wire: moving the descriptions on how to enable interfaces into one place would make docs more consistent I guess.
So first step would be to create a new page under https://www.home-assistant.io/hassio/enable_1-wire/ with the content of https://www.home-assistant.io/integrations/onewire/, then replacing the original content with a link to the new page.

The USB stick method does work for just modules, it doesn’t work for config.txt. In theory, you can edit config.txt on the SD, and then use a USB stick to create the modules configuration file, but that is a bit silly since you can just create another CONFIG folder in the boot partition directly today…

But anyway, the documentation on Github really is more development focused. There is not a lot of value with that link. I sent a merge request to remove it.

I’ll check your new instruction on Pi3 and Pi4 today.
I hope this will solve the issue once and for all :slight_smile:

@agners one question: Do we need to create files with special encoding or line ending? Like when importing ssh keys (https://developers.home-assistant.io/docs/operating-system/debugging/#home-assistant-operating-system)
If yes, then I think this info should be added to the instruction.