home-assistant: add holidays
This commit is contained in:
parent
6cd2b63d35
commit
0054694bdf
1 changed files with 16 additions and 2 deletions
|
@ -1,7 +1,19 @@
|
|||
{ config, ... }: {
|
||||
{ config, lib, ... }:
|
||||
let
|
||||
holiday-range = month: dayA: dayB:
|
||||
map (day: "${month}-${toString day}")
|
||||
(map (lib.fixedWidthNumber 2) (lib.range dayA dayB));
|
||||
privateHolidays = import <secrets/home-assistant/holidays>;
|
||||
# for example :
|
||||
# holidays = lib.flatten [
|
||||
# (holiday-range "2020-06" 7 24)
|
||||
# (holiday-range "2020-10" 10 16)
|
||||
#];
|
||||
holidays = lib.flatten (privateHolidays holiday-range);
|
||||
|
||||
in {
|
||||
services.homeAssistantConfig = {
|
||||
|
||||
# todo: add holidays package to home-assiatnt
|
||||
binary_sensor = [
|
||||
{
|
||||
name = "before_workday";
|
||||
|
@ -10,6 +22,7 @@
|
|||
province = "NW";
|
||||
workdays = [ "mon" "tue" "wed" "thu" "fri" ];
|
||||
days_offset = 1;
|
||||
add_holidays = holidays;
|
||||
}
|
||||
{
|
||||
name = "workday";
|
||||
|
@ -17,6 +30,7 @@
|
|||
country = "DE";
|
||||
province = "NW";
|
||||
workdays = [ "mon" "tue" "wed" "thu" "fri" ];
|
||||
add_holidays = holidays;
|
||||
}
|
||||
];
|
||||
|
||||
|
|
Loading…
Reference in a new issue