User Tools

Site Tools


rpi

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
rpi [2025/07/07 09:56] – created karciorpi [2025/07/07 11:31] (current) karcio
Line 1: Line 1:
-== Home Assistant, ESPHome, BMP280 - temperature and pressure monitoring. ==+== Home Assistant, ESPHome, BMP285 - temperature and pressure monitoring. ==
  
  
Line 14: Line 14:
  
 Raspberry Pi 3 Raspberry Pi 3
-{{ :img_3050.jpg?direct&600 |}}+{{ :0:img_3050.jpg?direct&600 |}}
  
 ESP32 controller ESP32 controller
-{{ :image0.jpeg?direct&600 |}}+{{ :0:image0.jpeg?direct&600 |}}
  
 BMP280 sensor BMP280 sensor
-{{ :image1.j+{{ :0:image1.jpeg?direct&600 |}} 
 + 
 +ESP32 custom case 
 +{{ :0:image_ob2.jpeg?direct&600 |}} 
 + 
 +== Prepare image HAOS: == 
 +  * download HAOS for your rpi from https://github.com/home-assistant/operating-system/releases/tag/13.0 
 +<code> 
 +https://github.com/home-assistant/operating-system/releases/download/13.0/haos_rpi2-13.0.img.xz 
 +</code> 
 +  * unpack image 
 +<code> 
 +unxz haos_rpi2-13.0.img.xz 
 +</code> 
 +  * insert sd card to your device and check how your machine recognize it - in mine case it is /dev/mmcbkl0 
 +<code> 
 +sudo fdisk -l 
 +</code> 
 +  * flash your sdcard 
 +<code> 
 +sudo dd if=Downloads/haos_rpi2-13.0.img  of=/dev/mmcblk0 status=progress bs=1M 
 +</code> 
 + 
 +== First run HA == 
 +  * insert sd card to RPI 
 +  * connect Ethernet cable 
 +  * insert WIFI dongle to usb port 
 +  * connect power to RPI and wait while for HA to run 
 +  * on your router check your rpi Ip address 
 +  * in web browser insert rpi Ip address with port 8123,  http://your_rpi_ip:8123 
 +  * first create account 
 + 
 +== Setup wifi connection on first run:== 
 +  * go to Settings > System > select Network and then wifi tab 
 +  * in ip4 select automatic 
 +  * in WI-FI scan network to find your network and insert SSID and password. Save after that 
 +  * reboot rpi to set up wifi 
 + 
 +== Install Add-ons:== 
 +  * go to : Settings > Add-ons 
 +  * click in add and install esphome and File editor 
 +  * esphome allows you to use esp32 
 +  * file editor allows you to edit config files and check syntax 
 + 
 +== HA config structure == 
 +  * configuration.yml 
 +  * automation.yml 
 +  * secrets.yml 
 + 
 +== Connect BMP280 to ESP32 == 
 +  * BMP280 sensor has 6 pins but we use just 4: VCC, GRN, SCL, SDA 
 +  * connet  pins as following: 
 +    * BMP280 VCC -> ESP32 3V 
 +    * BMP280 GRN -> ESP32 GRN 
 +    * BMP280 SCL -> ESP32 D22 
 +    * BMP280 SDA -> ESP32 D21 
 + 
 +ESP32 and BMP280 final photos. 
 + 
 +{{ :0:image_ob1.jpeg?direct&600 |}} 
 + 
 +{{ :0:image_ob0.jpeg?direct&600 |}} 
 + 
 +{{ :0:image_ob3.jpeg?direct&600 |}} 
 + 
 +== Connect esp32 to rpi for first initial flash == 
 +  * connect esp32 using usb cable to rpi do RPI 
 +  * open ESPHome tab 
 +  * click on add new device 
 + 
 +this is sample of config file: 
 + 
 +<code> 
 +esphome: 
 +  name: esp32-01 
 +  friendly_name: esp32-01 
 + 
 +esp32: 
 +  board: esp32dev 
 +  framework: 
 +    type: arduino 
 + 
 +# Enable logging 
 +logger: 
 + 
 +# Enable Home Assistant API 
 +api: 
 +  encryption: 
 +    key: "xxx" 
 + 
 +ota: 
 +  - platform: esphome 
 +    password: "xxx" 
 + 
 +wifi: 
 +  ssid: !secret wifi_ssid 
 +  password: !secret wifi_password 
 + 
 +  # Enable fallback hotspot (captive portal) in case wifi connection fails 
 +  ap: 
 +    ssid: "Esp32-01 Fallback Hotspot" 
 +    password: "xxx" 
 + 
 +captive_portal: 
 + 
 +i2c: 
 +  sda: 21 
 +  scl: 22 
 +  scan: True 
 + 
 +sensor: 
 +  - platform: bmp280_i2c 
 +    temperature: 
 +      name: "bedroom temperature" 
 +      oversampling: 16x 
 +    pressure: 
 +      name: "bedroom pressure" 
 +    address: 0x76 
 +    update_interval: 60s 
 +</code> 
 + 
 +This is how looks sample of automation config 
 + 
 +<code> 
 +alias: "Temperature" 
 +description: low temperature level 
 +trigger: 
 +  - platform: state 
 +    entity_id: 
 +      - sensor.temperature 
 +    to: null 
 +    for: 
 +      hours: 0 
 +      minutes: 30 
 +      seconds: 0 
 +condition: 
 +  - condition: or 
 +    conditions: 
 +      - condition: numeric_state 
 +        entity_id: sensor.temperature 
 +        above: 25 
 +      - condition: numeric_state 
 +        entity_id: sensor.temperature 
 +        below: 5 
 +      - condition: numeric_state 
 +        entity_id: sensor.temperature 
 +        below: 0 
 +action: 
 +  - data: 
 +      message: "Temperature is: {{ states('sensor.temperature')}} C" 
 +      title: "Warning: temperature is {{ states('sensor.temperature')}} C" 
 +    action: notify.email_notification 
 +mode: single 
 +</code> 
 + 
 +Whole documentation is here: https://www.home-assistant.io/installation/raspberrypi
rpi.1751882162.txt.gz · Last modified: by karcio