refactor folder structure
This commit is contained in:
71
hosts/fw/modules/home-assistant/pc.nix
Normal file
71
hosts/fw/modules/home-assistant/pc.nix
Normal file
@@ -0,0 +1,71 @@
|
||||
{
|
||||
services.home-assistant.extraComponents = [
|
||||
"wake_on_lan"
|
||||
];
|
||||
services.home-assistant.config = {
|
||||
ios = {
|
||||
actions = [
|
||||
{
|
||||
name = "Turn on PC";
|
||||
label.text = "Turn on PC";
|
||||
icon = {
|
||||
icon = "controller";
|
||||
color = "#ffffff";
|
||||
};
|
||||
show_in_watch = true;
|
||||
}
|
||||
];
|
||||
};
|
||||
wake_on_lan = {};
|
||||
"automation pc_switch" = {
|
||||
alias = "switch pc";
|
||||
trigger = {
|
||||
platform = "event";
|
||||
event_type = "button_pressed";
|
||||
event_data = {
|
||||
id = [ 254 235 105 198 ];
|
||||
onoff = 0;
|
||||
};
|
||||
};
|
||||
action = {
|
||||
service = "script.turn_on";
|
||||
target = {
|
||||
entity_id = "script.turn_on_pc";
|
||||
};
|
||||
};
|
||||
};
|
||||
script = {
|
||||
turn_on_pc = {
|
||||
sequence = [
|
||||
{
|
||||
service = "wake_on_lan.send_magic_packet";
|
||||
data = {
|
||||
mac = "04:7c:16:d5:63:5e";
|
||||
broadcast_address = "10.42.96.5";
|
||||
broadcast_port = 9;
|
||||
};
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
"automation turn on pc" = {
|
||||
trigger = [
|
||||
{
|
||||
platform = "event";
|
||||
event_type = "ios.action_fired";
|
||||
event_data = {
|
||||
actionID = "Turn on PC";
|
||||
};
|
||||
}
|
||||
];
|
||||
action = [
|
||||
{
|
||||
service = "script.turn_on";
|
||||
target = {
|
||||
entity_id = "script.turn_on_pc";
|
||||
};
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user