home-assistant: worked on kodi and wifi

This commit is contained in:
Ingolf Wagner 2020-05-10 23:58:19 +02:00
parent 2d87be4885
commit 93fa05acd8
Signed by: palo
GPG key ID: 76BF5F1928B9618B
4 changed files with 33 additions and 66 deletions

View file

@ -7,71 +7,36 @@
media_player = [{
platform = "kodi";
host = "127.0.0.1";
turn_on_action.service = "script.watch_tv";
turn_off_action.service = "script.stop_watch_tv";
}];
shell_command = {
start_display =
"sudo ${pkgs.systemd}/bin/systemctl start display-manager";
stop_display = "sudo ${pkgs.systemd}/bin/systemctl stop display-manager";
start_kodi = "sudo ${pkgs.systemd}/bin/systemctl start display-manager";
stop_kodi = "sudo ${pkgs.systemd}/bin/systemctl stop display-manager";
};
script = {
turn_all_off.sequence = [
# todo : use the shell_command here
{
alias = "turn off tv";
service = "switch.turn_off";
data.entity_id = "group.tv";
}
{
alias = "stop kodi";
service = "shell_command.stop_display";
}
];
test_display.sequence = [
{ service = "shell_command.start_display"; }
{ delay.seconds = 20; }
{ service = "shell_command.stop_display"; }
];
watch_tv = {
alias = "Watch TV";
sequence = [
{
alias = "turn on tv";
service = "switch.turn_on";
data.entity_id = "group.tv";
}
{ delay.seconds = 20; }
{
alias = "start kodi";
service = "shell_command.start_display";
}
];
};
stop_watch_tv = {
alias = "Stop TV";
sequence = [
{
alias = "turn off tv";
service = "switch.turn_off";
data.entity_id = "group.tv";
}
{
alias = "stop kodi";
service = "shell_command.stop_display";
}
];
};
};
group.tv.entities =
[ "script.watch_tv" "script.stop_watch_tv" "script.test_display" ];
automation = [
{
alias = "turn kodi on once the tv is turned on";
trigger = {
platform = "state";
entity_id = "group.tv";
from = "off";
to = "on";
for.seconds = 60;
};
action = [{ service = "shell_command.start_kodi"; }];
}
{
alias = "turn off kodi on once the tv is turned off";
trigger = {
platform = "state";
entity_id = "group.tv";
from = "on";
to = "off";
};
action = [{ service = "shell_command.stop_kodi"; }];
}
];
};

View file

@ -60,7 +60,7 @@ in {
16 numbers between 0 and 255
see https://www.zigbee2mqtt.io/how_tos/how_to_secure_network.html
'';
example = [7 3 5 7 9 11 13 15 0 2 4 6 8 11 12 13];
example = [ 7 3 5 7 9 11 13 15 0 2 4 6 8 11 12 13 ];
};
devices = mkOption {
type = with types; attrs;

View file

@ -4,10 +4,10 @@
enable = true;
autorun = false;
videoDrivers = [ "intel" ];
deviceSection = ''
Option "DRI" "2"
Option "TearFree" "true"
'';
#deviceSection = ''
# Option "DRI" "2"
# Option "TearFree" "true"
#'';
desktopManager = {
kodi.enable = true;
default = "kodi";

View file

@ -1,7 +1,9 @@
{ lib, pkgs, ... }:
let
wifi = "wlp0s29u1u1";
# you find this device using `ifconfig -a` or `ip link`
wifi = "wlp0s26u1u2";
#wifi = "wlp3s0-ifb";
ipAddress = "10.23.45.1";
prefixLength = 24;
servedAddressRange = "10.23.45.2,10.23.45.150,12h";