upgrade to ha-mqtt 1.3.0 and add included diagnostic sensors
This commit is contained in:
parent
a25746cfc9
commit
3f00d8c506
@ -2,6 +2,7 @@
|
||||
|
||||
#define MAIN_DEVICE_ID "rc-gateway"
|
||||
|
||||
#include "esp.h"
|
||||
#include "ha.h"
|
||||
|
||||
using namespace Ha;
|
||||
@ -40,11 +41,11 @@ namespace OilTank {
|
||||
return Builder<Sensor>::instance(new Sensor{ "Depth", id })
|
||||
.asDevice(device)
|
||||
.withDeviceClass("distance")
|
||||
.withUnitMseasure("cm")
|
||||
.withUnitMeasure("cm")
|
||||
.withValueTemplate("{{ value_json.sensor.value }}")
|
||||
.addSecondary(
|
||||
Builder<Sensor>::instance(new Sensor{ "Level", id })
|
||||
.withUnitMseasure("%")
|
||||
.withUnitMeasure("%")
|
||||
.withValueTemplate("{{ 100 - ((value_json.sensor.value-12)|float*100/120)|round(2) }}")
|
||||
.build()
|
||||
)
|
||||
@ -116,7 +117,10 @@ Command* commands[] = {
|
||||
[](const char* msg) {
|
||||
if (strcmp("PRESS", msg) == 0) ESP.restart();
|
||||
}
|
||||
}).asDevice(gatewayDevice).build(),
|
||||
}).asDevice(gatewayDevice)
|
||||
.addPreconfigured(HaESP::heapStats)
|
||||
.addPreconfigured(HaESP::restartInfo)
|
||||
.build(),
|
||||
Builder<Button>::instance(new Button{"Front door", "doorbell_front",
|
||||
[](const char* msg) {
|
||||
if (strcmp("PRESS", msg) == 0) doorbell.ring("00000000110100101000100");
|
||||
|
||||
@ -33,7 +33,7 @@ framework = arduino
|
||||
lib_deps =
|
||||
${env.lib_deps}
|
||||
arkhipenko/TaskScheduler@^3.8.5
|
||||
https://git.hodos.ro/libraries/ha-mqtt.git@^1.0.0
|
||||
https://git.hodos.ro/libraries/ha-mqtt.git@^1.3.0
|
||||
https://git.hodos.ro/libraries/wifi.git@^2.0.0
|
||||
upload_port = 192.168.6.161
|
||||
upload_protocol = espota
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user