Skip to content

Monitor your climate using an ESP32/ESP8266 and an BME280/BMP280

Notifications You must be signed in to change notification settings

krjan02/bmX280-weather-mqtt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Welcome to BMx280-weather-mqtt 👋

Using BME280/BMP280 and MQTT on ESP32 to monitor climate

This was made to monitor the weather in my House/Outside, i used a JSON Payload instead of seperated states for every value.

Prerequisites

This was made for the ESP32 and it's pretty straightforward to make this run on a ESP8266

I would suggest using VSCode with PlatformIO, even thoughyou can use the ArdunioIDE aswell, if you change the file structure

Libarys

Depending on your Sensor:

Sensor

Since you can use both BME280 or BME280, you can specify your sensor in global.h

#define SENSOR_BME280
//#define SENSOR_BMP280

This would now expect an BME280 Sensor

That's how you connect the BMx280 to the ESP:

BMx280 <----> ESP32
 SDA <-----> GPIO21
 SCL <-----> GPIO22

Usage

Enter your WifI and MQTT Settings in global.h just like this:

// WiFi
#define CONFIG_WIFI_HOST "mqtt-temp-livingroom"
#define CONFIG_WIFI_SSID "yourssid"
#define CONFIG_WIFI_PASS "yoursupersecretpassword"

// MQTT
#define CONFIG_MQTT_HOST "192.168.0.1"
#define CONFIG_MQTT_PORT 1883 // Usually 1883
#define CONFIG_MQTT_USER "hassio"
#define CONFIG_MQTT_PASS "secret123"
#define CONFIG_MQTT_CLIENT_ID "esp_temp_livingroom1" // Must be unique on the MQTT network
#define CONFIG_MQTT_TOPIC_STATE "home/esp_temp_livingroom" 

That's it, you can upload to the ESP!

HomeAssistant

- platform: mqtt
  name: "Livingroom °C"
  state_topic: "home/esp_temp_livingroom1"
  value_template: "{{ value_json.temp }}"
  unit_of_measurement: "°C"
  force_update: true
  
- platform: mqtt
  name: "Livingroom hPa"
  state_topic: "home/esp_temp_livingroom1"
  value_template: "{{ value_json.pressure }}"
  unit_of_measurement: "hPa"
  force_update: true

- platform: mqtt
  name: "Livingroom Humidity"
  state_topic: "home/esp_temp_livingroom1"
  value_template: "{{ value_json.humidity }}"
  unit_of_measurement: "%"
  force_update: true

Example

Author

👤 krjan02

Show your support

Give a ⭐️ if this project helped you!


About

Monitor your climate using an ESP32/ESP8266 and an BME280/BMP280

Topics

Resources

Stars

Watchers

Forks