nixos-config/nixos/configs/pepe/home-assistant/zigbee2mqtt/heater.nix

81 lines
2.4 KiB
Nix
Raw Normal View History

2020-10-30 00:36:00 +01:00
{ pkgs, lib, ... }:
let
# https://www.zigbee2mqtt.io/devices/SPZB0001.html
allDevices = {
2021-03-20 13:28:40 +01:00
"office_heater_1" = { id = "0x00158d00032f5ee4"; }; # office
"office_heater_2" = { id = "0x00158d00032f5f9f"; }; # office (kitchen)
"bedroom_heater_1" = { id = "0x00158d00032f6d1e"; }; # bed room
"storage_heater_1" = { id = "0x00158d00032f604d"; }; # abstell raum
2020-10-30 00:36:00 +01:00
};
# -t "zigbee2mqtt/heater3/set" -m '{"system_mode":"auto","current_heating_setpoint":23}'
# -t "zigbee2mqtt/heater3/set" -m '{"system_mode":"off"}'
in {
2020-11-22 01:58:32 +01:00
services.zigbee2mqttConfiguration = lib.mapAttrs' (name:
2020-10-30 00:36:00 +01:00
{ id, ... }: {
name = id;
value = {
2021-03-18 13:15:51 +01:00
legacy = false;
2020-10-30 00:36:00 +01:00
retain = false;
friendly_name = name;
transition = 1;
2020-11-01 23:59:51 +01:00
debounce = 0.5;
2020-11-08 21:41:34 +01:00
filtered_attributes = [
"battery_low"
"eurotronic_host_flags"
"eurotronic_system_mode"
2021-03-20 13:28:40 +01:00
#"occupied_heating_setpoint"
2020-12-19 23:31:14 +01:00
#"pi_heating_demand"
2021-03-20 13:28:40 +01:00
#"unoccupied_heating_setpoint"
2020-11-08 21:41:34 +01:00
];
2020-10-30 00:36:00 +01:00
};
}) allDevices;
services.homeAssistantConfig = {
2020-10-30 23:39:40 +01:00
sensor = lib.flatten (lib.mapAttrsToList (name:
{ ... }: [
{
name = "battery_${name}";
platform = "mqtt";
state_topic = "zigbee2mqtt/${name}";
availability_topic = "zigbee2mqtt/bridge/state";
unit_of_measurement = "%";
icon = "mdi:battery-10";
value_template = "{{ value_json.battery }}";
}
{
name = "link_${name}";
platform = "mqtt";
state_topic = "zigbee2mqtt/${name}";
availability_topic = "zigbee2mqtt/bridge/state";
icon = "mdi:signal";
unit_of_measurement = "lqi";
value_template = "{{ value_json.linkquality }}";
}
2020-11-08 21:41:34 +01:00
{
platform = "mqtt";
name = "temperature_${name}";
state_topic = "zigbee2mqtt/${name}";
availability_topic = "zigbee2mqtt/bridge/state";
unit_of_measurement = "°C";
device_class = "temperature";
value_template = "{{ value_json.local_temperature }}";
}
2020-12-20 01:33:24 +01:00
{
platform = "mqtt";
name = "pi_heating_demand_${name}";
state_topic = "zigbee2mqtt/${name}";
availability_topic = "zigbee2mqtt/bridge/state";
unit_of_measurement = "%";
value_template = "{{ value_json.pi_heating_demand }}";
}
2020-10-30 23:39:40 +01:00
]) allDevices);
2020-10-30 00:36:00 +01:00
};
}