Hi
Does anyone know how to enable I2C on hassio ?? I mean step by step instruction where to put commands which you can find on resin page…
CMD modprobe i2c-dev && python /app/demo.py
???
Hi
Does anyone know how to enable I2C on hassio ?? I mean step by step instruction where to put commands which you can find on resin page…
CMD modprobe i2c-dev && python /app/demo.py
???
A short Google search revealed this:
Hmmm. I did not checked that but my problem is that I want to switch from Hasbian to Hasio but I’m running several python scripts to control my covers via I2C. I’m using cover/command line component - so the problem is a bit more complicated since smbus libraby is used to send signals to outputs :)/
I have high hopes the new HassOS will be able to accomplish this. As I have had no luck getting the i2c BH1750 lux sensor to work with Hassio.
I spent a few days trying to configure and get my BH1750 light sensor to work via I2C bus on docker-based HassOS system. At the end I got succeded. I will share my step-by-steps here for people who struggles with it. Hope it helps you.
Currently I have HassOS 2.8 and Home assistant 0.87.1 running on my Raspberry Pi 3B.
Prerequisites: You will need an empty USB flash device.
First you need to access to the HassOS base system via SSH (this IS NOT the terminal used in HA web). According these steps here and here:
Generate a public and private key via PuTTYgen and save the private key (.ppk). Linux users can use openssl instead of PuTTYGen and skip the second step.
Load private_key via PuTTYGen again using “Load” button and copy the WHOLE HASH in the top window and save it in a file called authorized_keys
. This is important step so the key works on UNIX systems.
copy authorized_keys
into root directory of the freshly FAT/exFAT/NTFS
formatted USB Flash drive. NB! Some topics suggest the USB flash MUST be named CONFIG at formatting.
Now plug in this Flash drive in your Raspberry USB port
in HA web interface open the Hass.io tab → SYSTEM → HARDWARE button - under “disk” you should see your usb flash as /dev/sda
. If it is so, then press the Import from USB button to import the public key to HassOS.
from another PC (via PuTTY or linux shell) use the Private key to ssh to port 22222.
For Windows users via PuTTY:
enter your HassIO IP, choose port 22222 and choose the private key (.ppk file) via “connection” → SSH → Auth → “Browse”
for linux users:
ssh -i <path-to-your-saved-privatekey> root@<YourHassioIP> -p 22222
You’ll be logged in to the hassio-cli shell. Use login
command to access to the HassOS file system.
now as it is suggested in this topic
using your prefered CLI text editor add and save to /mnt/boot/config.txt
the following lines:
dtparam=i2c1=on
dtparam=i2c_arm=on
Alternatively you can add to the directory /etc/modules-load.d/ file named rpi-i2c.conf
with following lines in it:
i2c-dev
i2c-bcm2708
personally I did both.
dev/i2c-1
device or use i2c-tools
, but at this point your sensor should work if it is properly defined in your yaml configuration file.Good luck!
Nicely done. A little late for me though I ended up using an ESP board for the BH1750.
Hi guys! Thank you for this guide on how to enable I2C, but I have a question: what do you mean with “your sensor should work if it is properly defined in your yaml configuration file”? Can you provide a sample of your I2C sensor configuration in HA, please?
Do you know if this procedure will work also for TSL2561 lux sensor?
Thank you again!
Hey Ligio
I am using BH1750 which definition is described here: https://www.home-assistant.io/components/bh1750/
I am not sure if you can use TSL2561 directly on HASSIO, but you most definitely can use it on Wemos board with tasmota firmware and then pass it to HASSIO via MQTT.
Is possible enable SPI driver also?
MArco