83 lines
3.1 KiB
C++
83 lines
3.1 KiB
C++
#pragma once
|
|
|
|
#include "rc_devices.h"
|
|
|
|
using namespace Ha;
|
|
|
|
auto roomSensor = Builder<TemperatureSensor>(TEMP_SENSOR)
|
|
.asDevice(&DeviceConfig::create(TEMP_SENSOR)
|
|
.withName("Servers room")
|
|
.withManufacturer("Atmel")
|
|
.withModel("AtTiny85")
|
|
.withArea("Basement")
|
|
.withParent(gatewayDevice))
|
|
.withValueTemplate("{{ value_json.sensor.temperature }}")
|
|
.addPreconfigured(batterySensors<TemperatureSensor>(TEMP_SENSOR, BATTERY_PERCENTAGE_TEMPLATE(2.5, 2)))
|
|
.build();
|
|
|
|
auto tankSensor = Builder<Sensor>(new Sensor{ "Level", OIL_SENSOR })
|
|
.asDevice(&DeviceConfig::create(OIL_SENSOR)
|
|
.withName("Oil tank")
|
|
.withManufacturer("Arduino")
|
|
.withModel("Pro Mini")
|
|
.withArea("Basement")
|
|
.withParent(gatewayDevice))
|
|
.withUnitMeasure("%")
|
|
.withSensorStateClass(MEASUREMENT)
|
|
.withIcon("mdi:hydraulic-oil-level")
|
|
.withValueTemplate("{{ 100 - ((value_json.sensor.value-12)|float*100/120)|round(2) }}")
|
|
.addSecondary(
|
|
Builder<Sensor>(new Sensor{ "Depth", OIL_SENSOR })
|
|
.withDeviceClass("distance")
|
|
.withUnitMeasure("cm")
|
|
.withSensorStateClass(MEASUREMENT)
|
|
.withValueTemplate("{{ value_json.sensor.value }}")
|
|
.build()
|
|
)
|
|
.addPreconfigured(batterySensors<Sensor>(OIL_SENSOR, BATTERY_PERCENTAGE_TEMPLATE(4, 2.4)))
|
|
.build();
|
|
|
|
auto presenceTracker = Builder<BinarySensor>(PRESENCE_SENSOR)
|
|
.asDevice(&DeviceConfig::create(PRESENCE_SENSOR)
|
|
.withName("Kid presence")
|
|
.withManufacturer("Atmel")
|
|
.withModel("AtTiny85")
|
|
.withParent(gatewayDevice))
|
|
.withValueTemplate("{{ value_json.sensor.state }}")
|
|
.addPreconfigured(batterySensors<BinarySensor>(PRESENCE_SENSOR, BATTERY_PERCENTAGE_TEMPLATE(2.7, 0.6)))
|
|
.withOffDelaySeconds(5*60)
|
|
.withDeviceClass("presence")
|
|
.build();
|
|
|
|
Command* commands[] = {
|
|
HaESP::restartButton()
|
|
.asDevice(gatewayDevice)
|
|
.addPreconfigured(HaESP::heapStats)
|
|
.addPreconfigured(HaESP::restartInfo)
|
|
.addPreconfigured(HaESP::wifiInfo)
|
|
.build(),
|
|
#if ENABLE_DOORBELL
|
|
Builder<Button>(new Button{"Front door", "doorbell_front",
|
|
[](const char* msg) {
|
|
if (strcmp("PRESS", msg) == 0) doorbell.ring("00000000110100101000100");
|
|
}
|
|
})
|
|
.asDevice(
|
|
&DeviceConfig::create("doorbell")
|
|
.withName("Doorbell")
|
|
.withManufacturer("Thomson")
|
|
.withModel("Kinetic Halo")
|
|
.withParent(gatewayDevice)
|
|
)
|
|
.build(),
|
|
#endif
|
|
new EasyHomeSwitch{'A', (unsigned long[4]) { 4483136, 4626800, 4661552, 4819632 }, (unsigned long[4]) { 4326544, 4537104, 4767520, 4972704 }, "KabelBox", "Basement"},
|
|
new EasyHomeSwitch{'B', (unsigned long[4]) { 4483140, 4626804, 4661556, 4819636 }, (unsigned long[4]) { 4326548, 4537108, 4767524, 4972708 }},
|
|
new PollinSwitch{"00001", 1},
|
|
new PollinSwitch{"00001", 2, "Fire Tv", "Living room"},
|
|
new PollinSwitch{"00001", 3, "Diningroom player", "Dining room"},
|
|
new PollinSwitch{"00001", 4},
|
|
new PollinSwitch{"00011", 4, "homebox"},
|
|
new PollinSwitch{"11111", 4, "Train", "Playroom"}
|
|
};
|