upgrade to ha-mqtt v2.0.0
This commit is contained in:
parent
04b2d1c306
commit
bfd8b02f2a
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
using namespace Ha;
|
using namespace Ha;
|
||||||
|
|
||||||
auto roomSensor = Builder<TemperatureSensor>::instance(TEMP_SENSOR)
|
auto roomSensor = Builder<TemperatureSensor>(TEMP_SENSOR)
|
||||||
.asDevice(&DeviceConfig::create(TEMP_SENSOR)
|
.asDevice(&DeviceConfig::create(TEMP_SENSOR)
|
||||||
.withName("Servers room")
|
.withName("Servers room")
|
||||||
.withManufacturer("Atmel")
|
.withManufacturer("Atmel")
|
||||||
@ -15,7 +15,7 @@ auto roomSensor = Builder<TemperatureSensor>::instance(TEMP_SENSOR)
|
|||||||
.addPreconfigured(batterySensors<TemperatureSensor>(TEMP_SENSOR, BATTERY_PERCENTAGE_TEMPLATE(2.5, 2)))
|
.addPreconfigured(batterySensors<TemperatureSensor>(TEMP_SENSOR, BATTERY_PERCENTAGE_TEMPLATE(2.5, 2)))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
auto tankSensor = Builder<Sensor>::instance(new Sensor{ "Level", OIL_SENSOR })
|
auto tankSensor = Builder<Sensor>(new Sensor{ "Level", OIL_SENSOR })
|
||||||
.asDevice(&DeviceConfig::create(OIL_SENSOR)
|
.asDevice(&DeviceConfig::create(OIL_SENSOR)
|
||||||
.withName("Oil tank")
|
.withName("Oil tank")
|
||||||
.withManufacturer("Arduino")
|
.withManufacturer("Arduino")
|
||||||
@ -27,7 +27,7 @@ auto tankSensor = Builder<Sensor>::instance(new Sensor{ "Level", OIL_SENSOR })
|
|||||||
.withIcon("mdi:hydraulic-oil-level")
|
.withIcon("mdi:hydraulic-oil-level")
|
||||||
.withValueTemplate("{{ 100 - ((value_json.sensor.value-12)|float*100/120)|round(2) }}")
|
.withValueTemplate("{{ 100 - ((value_json.sensor.value-12)|float*100/120)|round(2) }}")
|
||||||
.addSecondary(
|
.addSecondary(
|
||||||
Builder<Sensor>::instance(new Sensor{ "Depth", OIL_SENSOR })
|
Builder<Sensor>(new Sensor{ "Depth", OIL_SENSOR })
|
||||||
.withDeviceClass("distance")
|
.withDeviceClass("distance")
|
||||||
.withUnitMeasure("cm")
|
.withUnitMeasure("cm")
|
||||||
.withSensorStateClass(MEASUREMENT)
|
.withSensorStateClass(MEASUREMENT)
|
||||||
@ -37,7 +37,7 @@ auto tankSensor = Builder<Sensor>::instance(new Sensor{ "Level", OIL_SENSOR })
|
|||||||
.addPreconfigured(batterySensors<Sensor>(OIL_SENSOR, BATTERY_PERCENTAGE_TEMPLATE(4, 2.4)))
|
.addPreconfigured(batterySensors<Sensor>(OIL_SENSOR, BATTERY_PERCENTAGE_TEMPLATE(4, 2.4)))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
auto presenceTracker = Builder<BinarySensor>::instance(PRESENCE_SENSOR)
|
auto presenceTracker = Builder<BinarySensor>(PRESENCE_SENSOR)
|
||||||
.asDevice(&DeviceConfig::create(PRESENCE_SENSOR)
|
.asDevice(&DeviceConfig::create(PRESENCE_SENSOR)
|
||||||
.withName("Kid presence")
|
.withName("Kid presence")
|
||||||
.withManufacturer("Atmel")
|
.withManufacturer("Atmel")
|
||||||
@ -57,7 +57,7 @@ Command* commands[] = {
|
|||||||
.addPreconfigured(HaESP::wifiInfo)
|
.addPreconfigured(HaESP::wifiInfo)
|
||||||
.build(),
|
.build(),
|
||||||
#if ENABLE_DOORBELL
|
#if ENABLE_DOORBELL
|
||||||
Builder<Button>::instance(new Button{"Front door", "doorbell_front",
|
Builder<Button>(new Button{"Front door", "doorbell_front",
|
||||||
[](const char* msg) {
|
[](const char* msg) {
|
||||||
if (strcmp("PRESS", msg) == 0) doorbell.ring("00000000110100101000100");
|
if (strcmp("PRESS", msg) == 0) doorbell.ring("00000000110100101000100");
|
||||||
}
|
}
|
||||||
|
|||||||
@ -41,6 +41,7 @@ namespace Board {
|
|||||||
turnLed(RED_LED, false);
|
turnLed(RED_LED, false);
|
||||||
turnLed(BLUE_LED);
|
turnLed(BLUE_LED);
|
||||||
|
|
||||||
|
WebServer::setup();
|
||||||
Mqtt::setup(&ts,
|
Mqtt::setup(&ts,
|
||||||
[] {turnLed(BLUE_LED, false);},
|
[] {turnLed(BLUE_LED, false);},
|
||||||
[] {turnLed(BLUE_LED);}
|
[] {turnLed(BLUE_LED);}
|
||||||
@ -49,7 +50,7 @@ namespace Board {
|
|||||||
[] {
|
[] {
|
||||||
Ota::tLoop.enable();
|
Ota::tLoop.enable();
|
||||||
Mqtt::tReConnect.enable();
|
Mqtt::tReConnect.enable();
|
||||||
WebServer::setup();
|
WebServer::start();
|
||||||
},
|
},
|
||||||
[] {
|
[] {
|
||||||
Ota::tLoop.disable();
|
Ota::tLoop.disable();
|
||||||
|
|||||||
@ -35,7 +35,7 @@ struct PollinSwitch : Switch {
|
|||||||
|
|
||||||
void onCommand(const char* msg) override {
|
void onCommand(const char* msg) override {
|
||||||
strcmp("ON", msg) == 0 ? mySwitch.switchOn(group, channel) : mySwitch.switchOff(group, channel);
|
strcmp("ON", msg) == 0 ? mySwitch.switchOn(group, channel) : mySwitch.switchOff(group, channel);
|
||||||
publisher(stateTopic, msg);
|
publisher(State::topic, msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
@ -69,7 +69,7 @@ struct EasyHomeSwitch : Switch {
|
|||||||
void onCommand(const char* msg) override {
|
void onCommand(const char* msg) override {
|
||||||
mySwitch.setProtocol(4);
|
mySwitch.setProtocol(4);
|
||||||
strcmp("ON", msg) == 0 ? mySwitch.send(on[4], 24) : mySwitch.send(off[4], 24);
|
strcmp("ON", msg) == 0 ? mySwitch.send(on[4], 24) : mySwitch.send(off[4], 24);
|
||||||
publisher(stateTopic, msg);
|
publisher(State::topic, msg);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -14,7 +14,6 @@ default_envs = huzzah
|
|||||||
[env]
|
[env]
|
||||||
lib_deps =
|
lib_deps =
|
||||||
sui77/rc-switch@^2.6.4
|
sui77/rc-switch@^2.6.4
|
||||||
bblanchon/ArduinoJson@6.21.5
|
|
||||||
adafruit/Adafruit Unified Sensor@^1.1.4
|
adafruit/Adafruit Unified Sensor@^1.1.4
|
||||||
https://github.com/adafruit/Adafruit-GFX-Library#1.2.2
|
https://github.com/adafruit/Adafruit-GFX-Library#1.2.2
|
||||||
https://github.com/adafruit/Adafruit_LED_Backpack#1.1.6
|
https://github.com/adafruit/Adafruit_LED_Backpack#1.1.6
|
||||||
@ -32,10 +31,8 @@ board = huzzah
|
|||||||
framework = arduino
|
framework = arduino
|
||||||
lib_deps =
|
lib_deps =
|
||||||
${env.lib_deps}
|
${env.lib_deps}
|
||||||
arkhipenko/TaskScheduler@^3.8.5
|
https://git.hodos.ro/libraries/ha-mqtt.git#2.0.0
|
||||||
https://git.hodos.ro/libraries/ha-mqtt.git@^1.13.0
|
|
||||||
https://git.hodos.ro/libraries/wifi.git@^2.0.0
|
https://git.hodos.ro/libraries/wifi.git@^2.0.0
|
||||||
esphome/ESPAsyncWebServer-esphome@^3.4.0
|
|
||||||
upload_port = 192.168.6.161
|
upload_port = 192.168.6.161
|
||||||
upload_protocol = espota
|
upload_protocol = espota
|
||||||
upload_flags =
|
upload_flags =
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user