home-assistant: worked on kodi and wifi
This commit is contained in:
parent
2d87be4885
commit
93fa05acd8
4 changed files with 33 additions and 66 deletions
|
@ -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 = [
|
alias = "turn kodi on once the tv is turned on";
|
||||||
# todo : use the shell_command here
|
trigger = {
|
||||||
{
|
platform = "state";
|
||||||
alias = "turn off tv";
|
entity_id = "group.tv";
|
||||||
service = "switch.turn_off";
|
from = "off";
|
||||||
data.entity_id = "group.tv";
|
to = "on";
|
||||||
}
|
for.seconds = 60;
|
||||||
{
|
};
|
||||||
alias = "stop kodi";
|
action = [{ service = "shell_command.start_kodi"; }];
|
||||||
service = "shell_command.stop_display";
|
}
|
||||||
}
|
{
|
||||||
];
|
alias = "turn off kodi on once the tv is turned off";
|
||||||
|
trigger = {
|
||||||
test_display.sequence = [
|
platform = "state";
|
||||||
{ service = "shell_command.start_display"; }
|
entity_id = "group.tv";
|
||||||
{ delay.seconds = 20; }
|
from = "on";
|
||||||
{ service = "shell_command.stop_display"; }
|
to = "off";
|
||||||
];
|
};
|
||||||
|
action = [{ service = "shell_command.stop_kodi"; }];
|
||||||
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" ];
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -60,7 +60,7 @@ in {
|
||||||
16 numbers between 0 and 255
|
16 numbers between 0 and 255
|
||||||
see https://www.zigbee2mqtt.io/how_tos/how_to_secure_network.html
|
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 {
|
devices = mkOption {
|
||||||
type = with types; attrs;
|
type = with types; attrs;
|
||||||
|
|
|
@ -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";
|
||||||
|
|
|
@ -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";
|
||||||
|
|
Loading…
Reference in a new issue