BME680 / BME280 sensor under RPI3 I²C GPIO with HASSIO

Hello El_Viejo

it doesn’t work because you copy the text.
if you paste the text into putty screen remove the ?

Reboot and it works :smiley:

afbeelding

Looks like there is a formatting issue - when you copy the command here, it copies another type of quotation marks. Actually - my bad, I just could have skipped using them in my example.

You can fix your added lines by removing these quotation marks like this:

sed -i ‘s/\“//g’ /mnt/boot/config.txt && sed -i ‘s/\”//g’ /mnt/boot/config.txt
sed -i ‘s/\”//g’ /etc/modules-load.d/rpi-i2c.conf && sed -i ‘s/\”//g’ /etc/modules-load.d/rpi-i2c.conf

Just tested and looks like the same problem is with these commands. You need to replace these “smart” single quotes with the straight ones in these 2 commands above. Hope you can manage it.

After this just make sure the quotes are gone and then reboot

Hello vitaalz and rubendijk:

I have managed to do this.
Putty_ok
Now, the error message does not appear and in Home Assistant I can see the three sensors of temperature, humidity and pressure.

vitaalz, using your commands, I get the error: "unsupported command".

With the suggestion of rubendijk, not removed the quotation marks, but I added the two correct lines.

Now I have to reconfigure Lovelace and later I will try to learn about templates.

Thanks a lot to both of them. Their patience is comparable to that of Job (the biblical character)

Hello.
I’m trying to make a BME280 sensor work on HASS.IO, but I can’t do it in any way.
I wrote the files mnt / boot / config.txt and etc / modules-load.d / rpi-i2c.conf
but hassio on reboot eliminates them both.
I wrote them both through PuTTY (as ‘root’) and from Web UI of the confugurator in Hassio.
Can anyone help me?
thanks

hello vitaalz,
I’m trying to do the same via PuTTY, but when i type ‘login’, it ask me login: and password:
but I haven’t
can you help me please?
image

Hi alexittitti,

Your hassio shell looks different from expected one. Did you follow all the instructions and SSH’d to port 22222 ?

hi vitaalz,
my PuTTY is configured on port:22222
pubblic and private keys works good, so i have access via SSH to Hassio as ‘root’ but as you can see i haven’t root’s privilege :frowning_face:
image
I don’t know why on the SSH server the port is 22222, but in the log it says ‘… listening on port:22’

image
and after connection it says other ports… in the picture ‘49483’.
image
I tryed to see in the hardware with the usb pen ‘CONFIG’ inserted, but Hass.io don’t see the disc /dev/sda


I am very angry and frustrated
a lot of thanks for your time

alexittitti,

I think you are digging in the wrong direction. You DO NOT NEED to change any network settings of the terminal on web interface. That is not the shell you need to login to. You can revert that setting back to default port (22).
The port 22222 is automatically opened when you successfully load your public key to your hassio. If you don’t see your USB drive as /dev/sda under Hass.io -> SYSTEM -> HARDWARE, you won’t be able to proceed with the key import. So work on that.
First make sure your keys are generated properly as it is described in my instruction. Then put the generated public key into the file called authorized_keys and copy this file to your FAT formatted USB stick named CONFIG. Plug it in your hassio and make sure USB appears in the Hardware list. If it is there, click on Import from USB.
After that use the private key to login to hassio via PuTTY on 22222 (see my PuTTY screenshots in this topic above)

Hope it helps

hello vitaalz,
I reinstalled everything from the image ‘hassos_rpi3-2.12.img’,
I generated a new pair of keys with PuTTYgen,
I configured PuTTY on port 22222 with the private key.
I created the file ‘authorized_keys’ without the extension and copied it to the FAT formatted USB named ‘CONFIG’.
in the Hass.io> System> Hardware continues to not appear /dev/sda.
I anyway tried Hass.io>System>Import from USB, but at the connection, via PuTTY, it asks me to log in, and when I type ‘root’, it rejects me because it doesn’t recognize the key (obviously, since I didn’t load it).

image
according to you, can I write the public key directly on the microSD?
if it is possible, in which directory, or in which file?
A lot of thanks

Well yeah if your USB device does not appear as /dev/sda in the Hardware, then of course you won’t be able to import the public key and will fail to SSH with your private key.

What is your setup? Are you actually using raspberry pi3? What is your Hassio version?

This weekend I will try to check If I can reproduce your situation. Who knows maybe things have changed since HassOS 2.8 and Home assistant 0.87.1 when I was actually doing it myself.

Meanwhile another thing you could try if you are installing hassio from scratch from the image - after you download the hassos_rpi3-2.12.img image, modify its contents before flashing it to your microSD with Etcher. In the image there is a config.txt file. Uncomment/add the following lines to it:

dtparam=i2c1=on
dtparam=i2c_arm=on

Then flash the modified image to the your microSD. I have no idea if this will work. Never tried it that way. But maybe it’s worth trying. Let me know.
I will let you know about the results of my experiments on the weekend sometime soon.

therefore
I’m using Raspberry pi 3 B
HassOS 2.12 - Home Assistant 0.101.3 (but this follows from the image)

I can’t change the config.txt file contained in the image that I see as a single .img file

I can try to modify the config.txt file if it is readable on the microSD after flashing.
I’ll let you know if this is possible.

yes, on the microSD I can modify the config.txt file, so I added only the first line that you recommend: dtparam=i2c1=on, because the second one was already without comment.

but on Hass.io owever i don’t see the bme280 sensor
in the configuration.yaml i have this lines
sensor:

  • platform: dht
    sensor: DHT22
    pin: 24
    temperature_offset: 2.1
    humidity_offset: -3.2
    monitored_conditions:
    • temperature
    • humidity
  • platform: command_line
    name: “RaspCPU”
    command: ‘cat /sys/class/thermal/thermal_zone0/temp’
    unit_of_measurement: ‘°C’
    value_template: ‘{{ value | multiply(0.001) | round(1)}}’
  • platform: bme680
    name: BME680 Sensor
    i2c_bus: 1
    i2c_address: 0x77
    monitored_conditions:
    • temperature
    • humidity
    • pressure

and on panoramic page i can see only DHT and CPU sensors
image

Hi alexittitti,

My idea was to make an experiment by modification of the config.txt before flashing and see if the i2c bus gets enabled during the hassio flashing/installation process. If you modified it after, you still need to create the /etc/modules-load.d/rpi-i2c.conf file on HassOS host system (NOT the home-assistant web interface terminal container) with the contents described above.

So on weekend I made a quick experiment. One thing is true - the USB flash drive when plugged in the RaspberryPi doesn’t show up /dev/sda or any other device in the HARDWARE section any more, even after reboot.
However I still was able to import the authorized_keys file by just clicking Import from USB and after log in to HassOS host system via ssh to 22222 with my private key.
Maybe the format of your private and public keys are not correct?
The content structure of authorized_keys file should look something like this:
ssh-rsa AAAAB3NzaC1...[LONG_STRING_HERE]...8NRh5Q== rsa-key-20190211

And the content structure of your_private_key.ppk should be something like this:

PuTTY-User-Key-File-2: ssh-rsa
Encryption: none
Comment: rsa-key-20190211
Public-Lines: 6
AAAAB3NzaC1.....
.....6_LINES....
...._OF_LONG_...
.....STRING_....
......HERE......
........8NRh5Q==
Private-Lines: 14
AAABA..........
......14.......
.....LINES.....
......OF.......
.....LONG......
.....STRING....
.....HERE.....
......TUF2oKg=
Private-MAC: 3504e....[ANOTHER_STRING_HERE].......ccfb

Make sure your key formats look the same and try again. Let me know about your progress.

As for your sensor - I think you need to define your BME280 as platform: bme280 (not bme680) as it is described here.

Hi vitaalz,
i think that the Key public/private structures are fine, because i used the same for ssh acces on the other rasp pi 3 b.
However tonight i try to create a new couple of them, and import from usb on a new system, after a new flashed microSD…
hope it works :slight_smile:
Therefore the second step will be the sensor definition.
I will keep you updated
thank you so much

Hi all!

please remember to rename the asterisk file under the /etc/modules-load.d/ directory to rpi-i2c.conf! this is needed because you cannot just add a new file! it will disappear upon boot.

you can do this using this command:

mv /etc/modules-load.d/* /etc/modules-load.d/rpi-i2c.conf

and in the end, edit the text file:

mnt/boot/config.txt

adding the following:

dtparam=i2c1=on dtparam=i2c_arm=on dtoverlay=pi3-disable-bt

by now I don’t know what to catch :frowning:
I flashed the microSD,
I restarted (20 minutes),
I created the USB ‘CONFIG’ and wrote the authorized_keys file (without extension), ANSI coding, copying from the ‘public key’ window of PuTTYgen, then with the appropriate format,
I did ‘import from USB’, rebooted everything,
now, compared to before I am a step backwards.
PuTTY does not reach the host.
image
as you can remember, yesterday it was this:
image
I redid everything a second time but the result does not change.
to be sure of the goodness of the keys and the reachability of Hass.io, I configured the SSH server add-on, with the same pair of keys, and PuTTY connects regularly, but I don’t have root rights, as we already know.
tomorrow maybe i can try again with a new power supply, otherwyse i don’t know what else

tomorrow maybe I can try again with a new power supply, otherwise I don’t know what else it can be, and in what mistake

see you, and a lot of thanks

thanks, but i think you are talking about a set of command that i need root authorization to do…
and i haven’t :frowning:
I’m struggling to be able to log in with ssh as root

that’s enough!
I give up!
If I can’t log in with root privileges, I can’t do anything else.
thanks to those who gave me a hand, even if I didn’t solve anything.
See you soon

Did you install SSH on your hassio? https://www.home-assistant.io/addons/ssh/

Yes, but it is indipendent for what i need.
SSH server don’t give me ‘root’ previleges, so i cannot create/modify file as described in this post, to configure BME280 in Hass.io.