Allow enabling I2C and 1wire via Home Assistant CLI

There are countless posts on the forum about problems with integrations that require I2C or 1wire.
The main reason for the problems is the complicated procedure of enabling I2C and 1Wire.

Take a look at some I2C instructions/problems:

Same with 1wire:

we have HA CLI that has host and hardware parameters.
Ideally, we should be able to enable/disable I2C and 1wire via CLI, similar to raspi-config (Configuring I2C | Adafruit's Raspberry Pi Lesson 4. GPIO Setup | Adafruit Learning System)

I propose adding commands:
ha host i2c - should return information about the current status of I2C
ha host i2c --enable - should enable I2C
ha host i2c --disable - should disable I2C
ha host 1wire - should return information about the current status of 1wire
ha host 1wire --enable - should enable 1wire
ha host 1wire --disable - should disable wire

I imagine this would be quite difficult to implement. By design, HA runs in a series of docker containers and is isolated from the underlying hardware or operating system - other than via the volumes and ports exposed during container creation. raspi-config requires root level access because it modifies /boot/config.txt.

I guess an addon could mount /boot/config.txt but I doubt it would have enough privilege to modify it.

Currently we have Homa Assistant CLI that has option to import settings from USB using ha os import

source is available here:

You misunderstood my feature request. I don’t want to have raspi-config, I would like to have more commands in HA CLI.
Extra addon isn’t needed :slight_smile:

Aah, quite right. Apologies @Misiu

1 Like

I’ve tried several times to enable I2C on RPI4 using Import from USB method, no luck.
My only success was using this method:

I think this should be added to CLI, supervisor and OS repos.

CLI import from USB option -
and supervisor endpoint to handle this:
this calls: which restarts “hassos-config.service”.

OS repo:

but that’s all I found.

I can try to add commands to CLI, add API to the supervisor, but I have no knowledge and experience with OS development, so I don’t know what job and where must be done to add support for this in OS.

Besides that, I am using Home Assistant with Raspberry Pi 3 and 4, so I don’t know what other hardware supports I2C and 1Wire (there should be a check somewhere if those commands are supported on specific hardware)

hi does it work on (DS2482S) via i2c? and PI4
I read that gpio PI4 is not on 1 wire reliable
I am looking for a reliable solution on PI4 via HA about 20 devices DS2406/2408 ?

does it work reliably for you?

I only used DS18B20 devices in the past.
The key was to use more PINS for one wire communication - Multiple 1-wire buses on the raspberry pi 3 and multiple DS18B20

1 Like