Merged in develop for #20
This commit is contained in:
commit
dcc67c7d8a
|
@ -1,19 +0,0 @@
|
||||||
#define ssid "Travis"
|
|
||||||
#define password "123456789"
|
|
||||||
#define hostname "esp32_room_presence"
|
|
||||||
#define mqttHost IPAddress(192, 168, 1, 195)
|
|
||||||
#define mqttPort 1883
|
|
||||||
#define mqttUser "homeassistant"
|
|
||||||
#define mqttPassword "123456789"
|
|
||||||
#define room "living-room"
|
|
||||||
#define LED_BUILTIN 2
|
|
||||||
#define LED_ON 0
|
|
||||||
#define channel "room_presence"
|
|
||||||
#define availabilityTopic "presence_nodes/" room
|
|
||||||
#define telemetryTopic "presence_nodes/" hostname "/tele"
|
|
||||||
#define scanInterval 15
|
|
||||||
#define singleScanTime 10
|
|
||||||
#define activeScan true
|
|
||||||
#define bleScanInterval 0x80
|
|
||||||
#define bleScanWindow 0x10
|
|
||||||
#define maxDistance 2
|
|
|
@ -15,6 +15,10 @@ src_dir = ./src
|
||||||
platform = espressif32
|
platform = espressif32
|
||||||
framework = arduino
|
framework = arduino
|
||||||
board = esp32dev
|
board = esp32dev
|
||||||
|
<<<<<<< HEAD
|
||||||
lib_deps = ArduinoJson@^6, ESP32 BLE Arduino@^1.0.1, AsyncMqttClient@^0.8.2, AsyncTCP
|
lib_deps = ArduinoJson@^6, ESP32 BLE Arduino@^1.0.1, AsyncMqttClient@^0.8.2, AsyncTCP
|
||||||
lib_ignore = ESPAsyncTCP
|
lib_ignore = ESPAsyncTCP
|
||||||
|
=======
|
||||||
|
lib_deps = ArduinoJSON@^6, ESP32 BLE Arduino@^1.0.1, AsyncMqttClient@^0.8.2, AsyncTCP, 2941@^1.2.1
|
||||||
|
>>>>>>> develop
|
||||||
board_build.partitions = partitions_singleapp.csv
|
board_build.partitions = partitions_singleapp.csv
|
||||||
|
|
|
@ -0,0 +1,36 @@
|
||||||
|
#include <Wire.h>
|
||||||
|
#include <HTU21D.h>
|
||||||
|
|
||||||
|
// SDA 21
|
||||||
|
// SCL 22
|
||||||
|
|
||||||
|
HTU21D temp_hum_sensor(HTU21D_RES_RH12_TEMP14);
|
||||||
|
bool htuIsConnected = false;
|
||||||
|
void sensor_setup()
|
||||||
|
{
|
||||||
|
int retryCount = 0;
|
||||||
|
while (temp_hum_sensor.begin() != true && retryCount < 5)
|
||||||
|
{
|
||||||
|
retryCount++;
|
||||||
|
delay(1000);
|
||||||
|
}
|
||||||
|
if (retryCount == 5) {
|
||||||
|
Serial.println("\n\rFailed to configure HTU21D sensor");
|
||||||
|
} else {
|
||||||
|
Serial.print("\n\rConnected to HTU21D: ");
|
||||||
|
Serial.println(temp_hum_sensor.readDeviceID());
|
||||||
|
htuIsConnected = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool htuSensorIsConnected() {
|
||||||
|
return htuIsConnected;
|
||||||
|
}
|
||||||
|
|
||||||
|
float getTemp() {
|
||||||
|
return round(temp_hum_sensor.readTemperature() * 100) / 100;
|
||||||
|
}
|
||||||
|
|
||||||
|
float getHumidity() {
|
||||||
|
return round(temp_hum_sensor.readHumidity() * 100) / 100;
|
||||||
|
}
|
Loading…
Reference in New Issue