move all devices creattion in devices.h
This commit is contained in:
parent
4b3ed383d8
commit
22add7aea8
@ -94,3 +94,22 @@ struct EasyHomeSwitch : Switch {
|
||||
publisher(stateTopic, msg);
|
||||
}
|
||||
};
|
||||
|
||||
Command* commands[] = {
|
||||
Builder<Button>::instance(new Button{"Restart", "restart",
|
||||
[](const char* msg) {
|
||||
if (strcmp("PRESS", msg) == 0) ESP.restart();
|
||||
}
|
||||
}).asDevice(gatewayDevice).build(),
|
||||
(new EasyHomeSwitch{"FritzBox", "easy_home_a", (unsigned long[4]) { 4483136, 4626800, 4661552, 4819632 }, (unsigned long[4]) { 4326544, 4537104, 4767520, 4972704 }, "Basement"})->withStateTopic(),
|
||||
(new EasyHomeSwitch{"Outside", "easy_home_b", (unsigned long[4]) { 4483140, 4626804, 4661556, 4819636 }, (unsigned long[4]) { 4326548, 4537108, 4767524, 4972708 }, "Basement"})->withStateTopic(),
|
||||
(new PollinSwitch{"Meeting sensor", "00001", 1, "Dining room"})->withStateTopic(),
|
||||
(new PollinSwitch{"Fire Tv", "00001", 2, "Living room"})->withStateTopic(),
|
||||
(new PollinSwitch{"Diningroom player", "00001", 3, "Dining room"})->withStateTopic(),
|
||||
(new PollinSwitch{"Train", "11111", 4, "Playroom"})->withStateTopic()
|
||||
};
|
||||
|
||||
Sensor* sensors[] = {
|
||||
OilTank::buildRoomSensor("4"),
|
||||
OilTank::buildTankSensor("7")
|
||||
};
|
||||
|
||||
@ -12,7 +12,7 @@ namespace Mqtt {
|
||||
|
||||
AsyncMqttClient client;
|
||||
|
||||
Task tReConnect(5 * TASK_MINUTE, TASK_FOREVER, []() {
|
||||
Task tReConnect(5 * TASK_MINUTE, TASK_FOREVER, []{
|
||||
Serial.println("Connecting to MQTT...");
|
||||
client.connect();
|
||||
}, &ts);
|
||||
@ -30,25 +30,6 @@ namespace Mqtt {
|
||||
return client.publish(topic, 0, true, message);
|
||||
}
|
||||
|
||||
Command* commands[] = {
|
||||
Builder<Button>::instance(new Button{"Restart", "restart",
|
||||
[](const char* msg) {
|
||||
if (strcmp("PRESS", msg) == 0) ESP.restart();
|
||||
}
|
||||
}).asDevice(gatewayDevice).build(),
|
||||
(new EasyHomeSwitch{"FritzBox", "easy_home_a", (unsigned long[4]) { 4483136, 4626800, 4661552, 4819632 }, (unsigned long[4]) { 4326544, 4537104, 4767520, 4972704 }, "Basement"})->withStateTopic(),
|
||||
(new EasyHomeSwitch{"Outside", "easy_home_b", (unsigned long[4]) { 4483140, 4626804, 4661556, 4819636 }, (unsigned long[4]) { 4326548, 4537108, 4767524, 4972708 }, "Basement"})->withStateTopic(),
|
||||
(new PollinSwitch{"Meeting sensor", "00001", 1, "Dining room"})->withStateTopic(),
|
||||
(new PollinSwitch{"Fire Tv", "00001", 2, "Living room"})->withStateTopic(),
|
||||
(new PollinSwitch{"Diningroom player", "00001", 3, "Dining room"})->withStateTopic(),
|
||||
(new PollinSwitch{"Train", "11111", 4, "Playroom"})->withStateTopic()
|
||||
};
|
||||
|
||||
Sensor* sensors[] = {
|
||||
OilTank::buildRoomSensor("4"),
|
||||
OilTank::buildTankSensor("7")
|
||||
};
|
||||
|
||||
void publishInit() {
|
||||
Ha::publisher = publish;
|
||||
Component::components.forEach([](Component* c) { c->publishConfig(); });
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user