Merge remote-tracking branch 'prism/master'

This commit is contained in:
tv 2022-09-06 19:19:23 +02:00
commit a4737bf422
5 changed files with 72 additions and 5 deletions

View File

@ -1,6 +1,6 @@
{ {
name="omo"; name="omo";
torrent = true; torrent = true;
unstable = true; #unstable = true;
home-manager = true; home-manager = true;
} }

View File

@ -3,7 +3,7 @@
full = true; full = true;
python = true; python = true;
hw = true; hw = true;
unstable = true; # unstable = true;
mic92 = true; mic92 = true;
clever_kexec = true; clever_kexec = true;
home-manager = true; home-manager = true;

View File

@ -0,0 +1,68 @@
{ lib, ... }:
# uses:
#
let
at_work = "input_boolean.felix_at_work";
dice_action = "sensor.arbeitszimmer_cube_action";
project_sensor = "sensor.felix_project";
hlib = import ../lib;
say = hlib.say.office;
sides = [ "BDK" "LBS6" "random" "BNO" "CyberShield" "ILBS" ];
hist_stat = state: {
platform = "history_stats";
name = "Felix Project ${state}";
entity_id = project_sensor;
inherit state;
type = "time";
start = "{{ now().replace(hour=0, minute=0, second=0) }}";
end = "{{ now() }}";
};
in
{
services.home-assistant.config.sensor = map hist_stat (sides ++ ["not at work" "unknown"]);
services.home-assistant.config.automation = [
{ alias = "Felix Project Change";
trigger =
{
platform = "state";
entity_id = project_sensor;
# ignore login and log out
not_from = [ "not at work" ];
not_to = [ "not at work" ];
};
action = (say "Wechsel auf Projekt {{ trigger.to_state.state }}");
}
];
services.home-assistant.config.template = [
{
trigger = [
{
platform = "state";
entity_id = at_work;
}
{
platform = "state";
attribute = "side";
entity_id = dice_action;
not_from = "";
}
];
sensor = [
{ name = "Felix Project";
state = ''
{% set at_work = states('${at_work}') == 'on' %}
{% set side = state_attr('${dice_action}','side') %}
{% if not at_work %}not at work
'' + (lib.concatImapStringsSep "\n" (i: project:
"{% elif side == ${toString (i - 1)} %}${project}") sides) +
''
{% else %}unknown
{% endif %}
'';
}
];
}
];
}

View File

@ -5,7 +5,6 @@
let let
prefix = (import ./lib).prefix; prefix = (import ./lib).prefix;
hassdir = "/var/lib/hass"; hassdir = "/var/lib/hass";
unstable = import <nixpkgs-unstable> {};
in { in {

View File

@ -488,8 +488,8 @@ awful.rules.rules = {
properties = { tag = tags[3] } }, properties = { tag = tags[3] } },
{ rule = { class = "Signal" }, { rule = { class = "Signal" },
properties = { tag = tags[4] } }, properties = { tag = tags[4] } },
{ rule = { class = "TelegramDesktop" }, -- { rule = { class = "TelegramDesktop" },
properties = { tag = tags[4] } }, -- properties = { tag = tags[4] } },
{ rule = { class = "Element" }, { rule = { class = "Element" },
properties = { tag = tags[4] } } properties = { tag = tags[4] } }
} }