home-assistant: fix mqtt and floorplan
Some checks failed
Check flake / build-amd64-linux (push) Failing after 3m22s
Some checks failed
Check flake / build-amd64-linux (push) Failing after 3m22s
This commit is contained in:
@ -1,94 +1,87 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
cfg = config.modules.services.home-assistant;
|
||||
in
|
||||
{
|
||||
config = lib.mkIf cfg.enable {
|
||||
services.home-assistant = {
|
||||
customLovelaceModules = [
|
||||
pkgs.lovelace-floorplan
|
||||
];
|
||||
services.home-assistant = {
|
||||
customLovelaceModules = [
|
||||
pkgs.lovelace-floorplan
|
||||
];
|
||||
};
|
||||
|
||||
environment.etc."home-assistant/www/floorplan/style.css".source = ./style.css;
|
||||
environment.etc."home-assistant/www/floorplan/config.yaml".text = builtins.toJSON {
|
||||
image = {
|
||||
location = "/local/floorplan/beetham.svg";
|
||||
cache = false;
|
||||
};
|
||||
stylesheet = {
|
||||
location = "/local/floorplan/style.css";
|
||||
cache = false;
|
||||
};
|
||||
|
||||
environment.etc."home-assistant/www/floorplan/style.css".source = ./style.css;
|
||||
environment.etc."home-assistant/www/floorplan/config.yaml".text = builtins.toJSON {
|
||||
image = {
|
||||
location = "/local/floorplan/beetham.svg";
|
||||
cache = false;
|
||||
};
|
||||
stylesheet = {
|
||||
location = "/local/floorplan/style.css";
|
||||
cache = false;
|
||||
};
|
||||
defaults = {
|
||||
hover_action = "hover-info";
|
||||
hold_action = "toggle";
|
||||
tap_action = "more-info";
|
||||
};
|
||||
|
||||
defaults = {
|
||||
hover_action = "hover-info";
|
||||
hold_action = "toggle";
|
||||
tap_action = "more-info";
|
||||
};
|
||||
|
||||
rules = [
|
||||
{
|
||||
name = "Rooms";
|
||||
entities = [
|
||||
{
|
||||
entity = "light.bedroom_lamps";
|
||||
element = "area.bedroom";
|
||||
rules = [
|
||||
{
|
||||
name = "Rooms";
|
||||
entities = [
|
||||
{
|
||||
entity = "light.bedroom_lamps";
|
||||
element = "area.bedroom";
|
||||
}
|
||||
{
|
||||
entity = "light.hallway_spots";
|
||||
element = "area.hallway";
|
||||
}
|
||||
{
|
||||
entity = "light.living_room_lamps";
|
||||
element = "area.livingroom";
|
||||
}
|
||||
{
|
||||
entity = "light.office_lamps";
|
||||
element = "area.office";
|
||||
}
|
||||
];
|
||||
tap_action = "light.toggle";
|
||||
state_action = {
|
||||
service = "floorplan.class_set";
|
||||
service_data = ''
|
||||
if (entity.state === "on") {
|
||||
return "light-on";
|
||||
}
|
||||
{
|
||||
entity = "light.hallway_spots";
|
||||
element = "area.hallway";
|
||||
}
|
||||
{
|
||||
entity = "light.living_room_lamps";
|
||||
element = "area.livingroom";
|
||||
}
|
||||
{
|
||||
entity = "light.office_lamps";
|
||||
element = "area.office";
|
||||
}
|
||||
];
|
||||
tap_action = "light.toggle";
|
||||
state_action = {
|
||||
service = "floorplan.class_set";
|
||||
return "light-off";
|
||||
'';
|
||||
};
|
||||
}
|
||||
{
|
||||
name = "Temperature";
|
||||
entities = [
|
||||
"sensor.motion_sensor_temperature"
|
||||
];
|
||||
state_action = [
|
||||
{
|
||||
service = "floorplan.text_set";
|
||||
service_data = ''
|
||||
if (entity.state === "on") {
|
||||
return "light-on";
|
||||
if (!isNaN(entity.state)) {
|
||||
return Math.round(entity.state * 10) / 10 + "°";
|
||||
}
|
||||
return "light-off";
|
||||
return "Unknown";
|
||||
'';
|
||||
};
|
||||
}
|
||||
{
|
||||
name = "Temperature";
|
||||
entities = [
|
||||
"sensor.motion_sensor_temperature"
|
||||
];
|
||||
state_action = [
|
||||
{
|
||||
service = "floorplan.text_set";
|
||||
service_data = ''
|
||||
if (!isNaN(entity.state)) {
|
||||
return Math.round(entity.state * 10) / 10 + "°";
|
||||
}
|
||||
return "Unknown";
|
||||
'';
|
||||
}
|
||||
{
|
||||
service = "floorplan.class_set";
|
||||
service_data = {
|
||||
class = "static-temp";
|
||||
};
|
||||
}
|
||||
];
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
||||
{
|
||||
service = "floorplan.class_set";
|
||||
service_data = {
|
||||
class = "static-temp";
|
||||
};
|
||||
}
|
||||
];
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
||||
|
Reference in New Issue
Block a user