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
No known key found for this signature in database
GPG key ID: 76BF5F1928B9618B
4 changed files with 33 additions and 66 deletions

View file

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

View file

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

View file

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