feature/InfluxDB-Connection-Update #1
3 changed files with 15 additions and 7 deletions
14
firmware/config_user.h.example
Normal file → Executable file
14
firmware/config_user.h.example
Normal file → Executable file
|
@ -9,18 +9,25 @@
|
||||||
|
|
||||||
// Enable/Disable features
|
// Enable/Disable features
|
||||||
//#define WEBUPDATER_FEATURE
|
//#define WEBUPDATER_FEATURE
|
||||||
#define INFLUXDB_FEATURE
|
//#define INFLUXDB_FEATURE
|
||||||
#define SERIAL_FEATURE
|
#define SERIAL_FEATURE
|
||||||
#define BATTERY_POWERED
|
//#define BATTERY_POWERED
|
||||||
#define SENSOR_WIND
|
//#define SENSOR_WIND
|
||||||
#define SENSOR_APDS9960
|
#define SENSOR_APDS9960
|
||||||
//#define SENSOR_APDS9930
|
//#define SENSOR_APDS9930
|
||||||
#define SENSOR_BME280
|
#define SENSOR_BME280
|
||||||
#define SENSOR_BATTERY
|
#define SENSOR_BATTERY
|
||||||
//#define BAT_PINS_D34
|
//#define BAT_PINS_D34
|
||||||
|
// only possible if webupdater is also enabled
|
||||||
|
//#define HOMEBRIDGE_WEBSTAT
|
||||||
|
// retries to connect after 5 seconds or starts the wifimanager
|
||||||
|
//#define SLEEP_IF_NO_WLAN_CONNECTION
|
||||||
|
// Restarts the firmware every n seconds
|
||||||
|
//#define RESET_ESP_TIMEINTERVAL
|
||||||
|
|
||||||
const float HUMIDITY_FACTOR = 1.0;
|
const float HUMIDITY_FACTOR = 1.0;
|
||||||
const float LIGHT_FACTOR = 1.0;
|
const float LIGHT_FACTOR = 1.0;
|
||||||
|
const float TEMP_FACTOR = 1.0;
|
||||||
|
|
||||||
// InfluxDB credentials
|
// InfluxDB credentials
|
||||||
const char *INFLUXDB_HOST = "hostname";
|
const char *INFLUXDB_HOST = "hostname";
|
||||||
|
@ -35,3 +42,4 @@ const char *INFLUXDB_PASS = "password";
|
||||||
String DEVICE_NAME = "devicename";
|
String DEVICE_NAME = "devicename";
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -67,10 +67,10 @@ void setup()
|
||||||
// the time in seconds to wait for the user to configure the device
|
// the time in seconds to wait for the user to configure the device
|
||||||
wifiManager.setTimeout(WIFI_CONFIG_PORTAL_TIMEOUT_S);
|
wifiManager.setTimeout(WIFI_CONFIG_PORTAL_TIMEOUT_S);
|
||||||
|
|
||||||
#ifdef SLEEP_IF_NO_WLAN_CONNECTION
|
#ifndef SLEEP_IF_NO_WLAN_CONNECTION
|
||||||
while
|
while
|
||||||
#endif
|
#endif
|
||||||
#ifndef SLEEP_IF_NO_WLAN_CONNECTION
|
#if def SLEEP_IF_NO_WLAN_CONNECTION
|
||||||
if
|
if
|
||||||
#endif
|
#endif
|
||||||
(!wifiManager.autoConnect(wifiName.c_str(), "DEADBEEF"))
|
(!wifiManager.autoConnect(wifiName.c_str(), "DEADBEEF"))
|
||||||
|
|
4
firmware/sensor_bme280.ino
Executable file → Normal file
4
firmware/sensor_bme280.ino
Executable file → Normal file
|
@ -14,11 +14,11 @@ bool sensor_bme280_begin(uint8_t addr) {
|
||||||
}
|
}
|
||||||
|
|
||||||
float bme280_temperature() {
|
float bme280_temperature() {
|
||||||
return _sensor_bme280.readTemperature();
|
return _sensor_bme280.readTemperature() * TEMP_FACTOR;
|
||||||
}
|
}
|
||||||
float bme280_pressure() {
|
float bme280_pressure() {
|
||||||
return _sensor_bme280.readPressure() / 100.0F;
|
return _sensor_bme280.readPressure() / 100.0F;
|
||||||
}
|
}
|
||||||
float bme280_humidity() {
|
float bme280_humidity() {
|
||||||
return _sensor_bme280.readHumidity() * HUMIDITY_FACTOR;
|
return _sensor_bme280.readHumidity() * HUMIDITY_FACTOR;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue