Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions environments.ini
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,51 @@
;List of environments that can be build ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

[env:tinypico-bmp390-usb]
platform = espressif32
board = tinypico
framework = arduino

monitor_speed = 115200
;upload_speed = 921600

;board_build.partitions = huge_app.csv
board_build.partitions = partitions/min_spiffs.csv

build_flags =
-DGateway_Name=\"OMG_TinyPICO_BMP390\"
-DZsensorBMP390=\"BMP390\"
-DDEFAULT_I2C_SDA=21
-DDEFAULT_I2C_SCL=22
-DLOG_LEVEL=LOG_LEVEL_NOTICE
-DENV_NAME=\"tinypico-bmp390-usb\"
-DZwebUI=\"WebUI\"
-DZwebServer=true
-DZmqttDiscovery=\"HADiscovery\"
-DvalueAsATopic=true
-UZgatewayBT
-UZgatewayBLE
-UZgatewayBLEConnect
-UZgatewayIR
-UZgatewayLORA
-UZgatewayRF
-UZgatewayRTL_433
-UZgatewayPilight
-UZgatewaySERIAL

lib_deps =
${env.lib_deps}
${com-esp32.lib_deps}
${libraries.ble}
${libraries.decoder}
adafruit/Adafruit BMP3XX Library
adafruit/Adafruit Unified Sensor

lib_ignore =
NimBLE-Arduino
TheengsDecoder


[env:rfbridge]
platform = ${com.esp8266_platform}
board = esp8285
Expand Down Expand Up @@ -232,6 +277,7 @@ build_flags =
'-DZsensorADC="ADC"'
'-DZsensorBH1750="BH1750"'
'-DZsensorBME280="BME280"'
'-DZsensorBMP390="BMP390"'
'-DBME280Correction=-3.4'
'-DZsensorHTU21="HTU21"'
'-DZsensorAHTx0="AHTx0"'
Expand Down
1 change: 1 addition & 0 deletions main/User_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,7 @@ extern ss_cnt_parameters cnt_parameters_array[];
//#define ZsensorTEMT6000 "TEMT6000" //ESP8266
//#define ZsensorTSL2561 "TSL2561" //ESP8266, Arduino, ESP32
//#define ZsensorBME280 "BME280" //ESP8266, Arduino, ESP32
//#define ZsensorBMP390 "BMP390" //ESP8266, Arduino, ESP32
//#define ZsensorHTU21 "HTU21" //ESP8266, Arduino, ESP32
//#define ZsensorLM75 "LM75" //ESP8266, Arduino, ESP32
//#define ZsensorDHT "DHT" //ESP8266, Arduino, ESP32, Sonoff RF Bridge
Expand Down
105 changes: 105 additions & 0 deletions main/config_BMP390.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
/*
Theengs OpenMQTTGateway - We Unite Sensors in One Open-Source Interface

Act as a gateway between your 433mhz, infrared IR, BLE, LoRa signal and one interface like an MQTT broker
Send and receiving command by MQTT

This files enables you to set parameters for the BMP390 sensor.

Copyright: (c) Hans-Juergen Dinges

This file is part of OpenMQTTGateway.

OpenMQTTGateway is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

OpenMQTTGateway is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.

Connection Schemata:
--------------------

BMP390 ------> ESP8266
==============================
Vcc ----------------> 5V/3.3V (5V or 3.3V depends on the BMP390 board variant)
GND ----------------> GND
SCL ----------------> D1
SDA ----------------> D2

*/
#ifndef config_BMP390_h
#define config_BMP390_h

extern void setupZsensorBMP390();
extern void MeasureTempAndPressureBMP390();

#ifndef bmp390_always
# define bmp390_always true // if false when the current value of the parameter is the same as previous one don't send it by MQTT
#endif
#ifndef TimeBetweenReadingbmp390
# define TimeBetweenReadingbmp390 30000
#endif

/*----------------------------USER PARAMETERS-----------------------------*/
/*-------------DEFINE YOUR MQTT PARAMETERS BELOW----------------*/
#ifndef BMP390TOPIC
# define BMP390TOPIC "/CLIMAtoMQTT/bmp390"
#endif

// I2C address options for BMP390 boards (commonly 0x76 or 0x77)
#ifndef BMP390_I2C_ADDR1
# define BMP390_I2C_ADDR1 0x77
#endif
#ifndef BMP390_I2C_ADDR2
# define BMP390_I2C_ADDR2 0x76
#endif

// Only supported for ESP
#ifndef BMP390_PIN_SDA
# define BMP390_PIN_SDA SDA
#endif
#ifndef BMP390_PIN_SCL
# define BMP390_PIN_SCL SCL
#endif

// Oversampling for BMP390 devices

#ifndef BMP390TemperatureOversample
// BMP390TemperatureOversample - Values:
// ------------------------
// 0, skipped
// 1 through 5, oversampling *2, *4, *8, *16, *32 respectively (BMP3XX does not expose 1x)
# define BMP390TemperatureOversample 1
#endif

#ifndef BMP390PressureOversample
// BMP390PressureOversample - Values:
// -------------------------
// 0, skipped
// 1 through 5, oversampling *2, *4, *8, *16, *32 respectively (BMP3XX does not expose 1x)
# define BMP390PressureOversample 1
#endif

// Temperature correction for BMP390 devices

#ifndef BMP390Correction
// BMP390Correction - Correction in Celsius of temperature reported by BMP390 sensor. Both Celsius and Fahrenheit temperatures are adjusted.
// -------------------------
// Value is a float
// ie Compiler Directive '-DBMP390Correction=-3.4'
# define BMP390Correction 0
#endif

// Sea-level pressure reference in hPa (used to compute altitude)
#ifndef BMP390_SEALEVEL_HPA
# define BMP390_SEALEVEL_HPA 1013.25f
#endif

#endif
10 changes: 10 additions & 0 deletions main/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,9 @@ Preferences preferences;
#ifdef ZsensorBME280
# include "config_BME280.h"
#endif
#ifdef ZsensorBMP390
# include "config_BMP390.h"
#endif
#ifdef ZsensorHTU21
# include "config_HTU21.h"
#endif
Expand Down Expand Up @@ -1484,6 +1487,10 @@ void setup() {
setupZsensorBME280();
modules.add(ZsensorBME280);
#endif
#ifdef ZsensorBMP390
setupZsensorBMP390();
modules.add(ZsensorBMP390);
#endif
#ifdef ZsensorHTU21
setupZsensorHTU21();
modules.add(ZsensorHTU21);
Expand Down Expand Up @@ -2623,6 +2630,9 @@ void loop() {
#ifdef ZsensorBME280
MeasureTempHumAndPressure(); //Addon to measure Temperature, Humidity, Pressure and Altitude with a Bosch BME280/BMP280
#endif
#ifdef ZsensorBMP390
MeasureTempAndPressureBMP390(); //Addon to measure Temperature and Pressure with a Bosch BMP390
#endif
#ifdef ZsensorHTU21
MeasureTempHum(); //Addon to measure Temperature, Humidity, of a HTU21 sensor
#endif
Expand Down
15 changes: 14 additions & 1 deletion main/mqttDiscovery.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -820,6 +820,19 @@ void pubMqttDiscovery() {
true, BMETOPIC, will_Topic, nullptr);
# endif

# ifdef ZsensorBMP390
# include "config_BMP390.h"
const char* BMP390sensor[][13] = {
{HASS_TYPE_SENSOR, "BMP390: Temp", "bmp390-temp", HASS_CLASS_TEMPERATURE, jsonTempc, "", "", HASS_UNIT_CELSIUS, stateClassMeasurement, nullptr, nullptr, nullptr, nullptr},
{HASS_TYPE_SENSOR, "BMP390: Pressure", "bmp390-pressure", HASS_CLASS_PRESSURE, jsonPa, "", "", HASS_UNIT_HPA, stateClassMeasurement, nullptr, nullptr, nullptr, nullptr},
{HASS_TYPE_SENSOR, "BMP390: Altitude", "bmp390-altim", "", jsonAltim, "", "", HASS_UNIT_METER, stateClassMeasurement, nullptr, nullptr, nullptr, nullptr},
{HASS_TYPE_SENSOR, "BMP390: Altitude (ft)", "bmp390-altift", "", jsonAltif, "", "", HASS_UNIT_FT, stateClassMeasurement, nullptr, nullptr, nullptr, nullptr}};

THEENGS_LOG_TRACE(F("bmp390Discovery" CR));
createDiscoveryFromList(nullptr, BMP390sensor, 4, nullptr, nullptr, nullptr,
true, BMP390TOPIC, will_Topic, nullptr);
# endif

# ifdef ZsensorHTU21
# include "config_HTU21.h"
const char* HTUsensor[][13] = {
Expand Down Expand Up @@ -1152,4 +1165,4 @@ void pubMqttDiscovery() {
}
#else
void pubMqttDiscovery() {}
#endif
#endif
Loading
Loading