mirror of
https://github.com/anotherhadi/nixy.git
synced 2026-10-05 11:18:24 +02:00
add uptime kuma, card-mod and others
Signed-off-by: Hadi <[email protected]>
This commit is contained in:
@@ -25,6 +25,7 @@
|
|||||||
../../server-modules/signal-cli-rest-api.nix
|
../../server-modules/signal-cli-rest-api.nix
|
||||||
../../server-modules/home-assistant
|
../../server-modules/home-assistant
|
||||||
../../server-modules/miniflux.nix
|
../../server-modules/miniflux.nix
|
||||||
|
../../server-modules/uptime-kuma.nix
|
||||||
|
|
||||||
# You should let those lines as is
|
# You should let those lines as is
|
||||||
./hardware-configuration.nix
|
./hardware-configuration.nix
|
||||||
|
|||||||
@@ -53,6 +53,7 @@ in {
|
|||||||
"meteo_france"
|
"meteo_france"
|
||||||
"remote_calendar"
|
"remote_calendar"
|
||||||
"systemmonitor"
|
"systemmonitor"
|
||||||
|
"uptime_kuma"
|
||||||
];
|
];
|
||||||
customComponents = plugins.customComponents;
|
customComponents = plugins.customComponents;
|
||||||
customLovelaceModules = plugins.customLovelaceModules;
|
customLovelaceModules = plugins.customLovelaceModules;
|
||||||
@@ -65,7 +66,11 @@ in {
|
|||||||
scene = "!include scenes.yaml";
|
scene = "!include scenes.yaml";
|
||||||
automation = "!include automations.yaml";
|
automation = "!include automations.yaml";
|
||||||
script = "!include scripts.yaml";
|
script = "!include scripts.yaml";
|
||||||
frontend.themes = nixyTheme;
|
frontend = {
|
||||||
|
themes = nixyTheme;
|
||||||
|
# Load card-mod early so it can style every card
|
||||||
|
extra_module_url = ["/local/nixos-lovelace-modules/card-mod.js"];
|
||||||
|
};
|
||||||
# Timestamp of the last motion detection (trigger-based, survives restarts)
|
# Timestamp of the last motion detection (trigger-based, survives restarts)
|
||||||
template =
|
template =
|
||||||
map (room: {
|
map (room: {
|
||||||
@@ -86,7 +91,61 @@ in {
|
|||||||
}
|
}
|
||||||
];
|
];
|
||||||
})
|
})
|
||||||
motionRooms;
|
motionRooms
|
||||||
|
++ [
|
||||||
|
# Uptime Kuma monitors that are not up (down, pending or maintenance)
|
||||||
|
{
|
||||||
|
sensor = [
|
||||||
|
{
|
||||||
|
name = "Websites not up";
|
||||||
|
unique_id = "websites_not_up";
|
||||||
|
icon = "mdi:web-off";
|
||||||
|
state = ''
|
||||||
|
{{ integration_entities('uptime_kuma')
|
||||||
|
| select('match', 'sensor\.')
|
||||||
|
| select('is_state', ['down', 'pending', 'maintenance'])
|
||||||
|
| list | count }}
|
||||||
|
'';
|
||||||
|
attributes.sites = ''
|
||||||
|
{{ integration_entities('uptime_kuma')
|
||||||
|
| select('match', 'sensor\.')
|
||||||
|
| select('is_state', ['down', 'pending', 'maintenance'])
|
||||||
|
| map('device_attr', 'name')
|
||||||
|
| list }}
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
];
|
||||||
|
}
|
||||||
|
# Battery sensors below 15%
|
||||||
|
{
|
||||||
|
sensor = [
|
||||||
|
{
|
||||||
|
name = "Batteries to replace";
|
||||||
|
unique_id = "batteries_to_replace";
|
||||||
|
icon = "mdi:battery-alert-variant-outline";
|
||||||
|
state = ''
|
||||||
|
{{ states.sensor
|
||||||
|
| selectattr('attributes.device_class', 'defined')
|
||||||
|
| selectattr('attributes.device_class', 'eq', 'battery')
|
||||||
|
| map(attribute='state')
|
||||||
|
| select('is_number') | map('float')
|
||||||
|
| select('lt', 15)
|
||||||
|
| list | count }}
|
||||||
|
'';
|
||||||
|
attributes.devices = ''
|
||||||
|
{% set ns = namespace(low=[]) %}
|
||||||
|
{% for s in states.sensor
|
||||||
|
| selectattr('attributes.device_class', 'defined')
|
||||||
|
| selectattr('attributes.device_class', 'eq', 'battery')
|
||||||
|
if is_number(s.state) and s.state | float < 15 %}
|
||||||
|
{% set ns.low = ns.low + [s.name ~ ' (' ~ s.state | int ~ '%)'] %}
|
||||||
|
{% endfor %}
|
||||||
|
{{ ns.low }}
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
];
|
||||||
|
}
|
||||||
|
];
|
||||||
alarm_control_panel = [
|
alarm_control_panel = [
|
||||||
{
|
{
|
||||||
platform = "manual";
|
platform = "manual";
|
||||||
|
|||||||
@@ -64,5 +64,6 @@ in {
|
|||||||
pkgs.home-assistant-custom-lovelace-modules.bubble-card
|
pkgs.home-assistant-custom-lovelace-modules.bubble-card
|
||||||
pkgs.home-assistant-custom-lovelace-modules.auto-entities
|
pkgs.home-assistant-custom-lovelace-modules.auto-entities
|
||||||
pkgs.home-assistant-custom-lovelace-modules.mushroom
|
pkgs.home-assistant-custom-lovelace-modules.mushroom
|
||||||
|
pkgs.home-assistant-custom-lovelace-modules.card-mod
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,29 @@
|
|||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
inherit (import ./mk-container.nix {inherit lib config;}) mkContainer;
|
||||||
|
in {
|
||||||
|
imports = [
|
||||||
|
(mkContainer {
|
||||||
|
name = "uptime-kuma";
|
||||||
|
hostIp = "10.233.13.1";
|
||||||
|
containerIp = "10.233.13.2";
|
||||||
|
internet = true;
|
||||||
|
nixosConfig = {...}: {
|
||||||
|
services.uptime-kuma = {
|
||||||
|
enable = true;
|
||||||
|
settings = {
|
||||||
|
HOST = "0.0.0.0";
|
||||||
|
PORT = "3001";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
networking.firewall.allowedTCPPorts = [3001];
|
||||||
|
system.stateVersion = "24.05";
|
||||||
|
};
|
||||||
|
})
|
||||||
|
];
|
||||||
|
|
||||||
|
services.cloudflared.tunnels."${config.var.tunnelId}".ingress."uptime.${config.var.domain}" = "http://10.233.13.2:3001";
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user