Files
nixos/hosts/fw/modules/home-assistant/remote.nix

334 lines
7.6 KiB
Nix

let
remote_entity = "remote.living_room";
media_player_entity = "media_player.living_room";
in {
services.home-assistant.config = {
"automation press power" = {
alias = "steamdeck on";
trigger = {
platform = "event";
event_type = "esphome.hid_events";
event_data = {
usage = "Keyboard Power";
value = "1";
};
};
action = [
{
choose = [
{
conditions = [
{
condition = "state";
entity_id = "switch.tv_switch";
state = "off";
}
];
sequence = [
{
service = "script.turn_on";
target = {
entity_id = "script.turn_on_tv";
};
}
];
}
{
conditions = [
{
condition = "template";
value_template = "{{ states('media_player.living_room') != 'off' }}";
}
];
sequence = [
{
action = "remote.send_command";
target = {
entity_id = remote_entity;
};
data = {
hold_secs = 1;
command = "home";
};
}
];
}
];
}
];
};
"automation remote press up" = {
alias = "remote press up";
trigger = {
platform = "event";
event_type = "esphome.hid_events";
event_data = {
usage = "Keyboard UpArrow";
value = "1";
};
};
action = [
{
action = "remote.send_command";
target = {
entity_id = remote_entity;
};
data = {
command = "up";
};
}
];
};
"automation remote press right" = {
alias = "remote press right";
trigger = {
platform = "event";
event_type = "esphome.hid_events";
event_data = {
usage = "Keyboard RightArrow";
value = "1";
};
};
action = [
{
action = "remote.send_command";
target = {
entity_id = remote_entity;
};
data = {
command = "right";
};
}
];
};
"automation remote press down" = {
alias = "remote press down";
trigger = {
platform = "event";
event_type = "esphome.hid_events";
event_data = {
usage = "Keyboard DownArrow";
value = "1";
};
};
action = [
{
action = "remote.send_command";
target = {
entity_id = remote_entity;
};
data = {
command = "down";
};
}
];
};
"automation remote press left" = {
alias = "remote press left";
trigger = {
platform = "event";
event_type = "esphome.hid_events";
event_data = {
usage = "Keyboard LeftArrow";
value = "1";
};
};
action = [
{
action = "remote.send_command";
target = {
entity_id = remote_entity;
};
data = {
command = "left";
};
}
];
};
"automation remote press enter" = {
alias = "remote press enter";
trigger = {
platform = "event";
event_type = "esphome.hid_events";
event_data = {
usage = "Keypad ENTER";
value = "1";
};
};
action = [
{
action = "remote.send_command";
target = {
entity_id = remote_entity;
};
data = {
command = "select";
};
}
];
};
"automation remote press return" = {
alias = "remote press return";
trigger = {
platform = "event";
event_type = "esphome.hid_events";
event_data = {
usage = "7_241";
value = "1";
};
};
action = [
{
action = "remote.send_command";
target = {
entity_id = remote_entity;
};
data = {
command = "menu";
};
}
];
};
"automation remote press home" = {
alias = "remote press home";
trigger = {
platform = "event";
event_type = "esphome.hid_events";
event_data = {
usage = "AC Home";
value = "1";
};
};
action = [
{
action = "remote.send_command";
target = {
entity_id = remote_entity;
};
data = {
command = "home";
};
}
];
};
"automation remote press Menu" = {
alias = "remote press menu";
trigger = {
platform = "event";
event_type = "esphome.hid_events";
event_data = {
usage = "Menu";
value = "1";
};
};
action = [
{
action = "remote.send_command";
target = {
entity_id = remote_entity;
};
data = {
hold_secs = 1;
command = "select";
};
}
];
};
"automation remote press program guide" = {
alias = "remote press program guide";
trigger = {
platform = "event";
event_type = "esphome.hid_events";
event_data = {
usage = "Media Select Program Guide";
value = "1";
};
};
action = [
{
service = "automation.trigger";
target = {
entity_id = "automation.multimedia_scene_switch";
};
}
];
};
"automation remote press 1" = {
alias = "remote press 1";
trigger = {
platform = "event";
event_type = "esphome.hid_events";
event_data = {
usage = "AC Set Clock";
value = "1";
};
};
action = [
{
service = "light.toggle";
target = {
entity_id = "light.livingroom_switch";
};
}
];
};
"automation remote press 2" = {
alias = "remote press 2";
trigger = {
platform = "event";
event_type = "esphome.hid_events";
event_data = {
usage = "AC View Clock";
value = "1";
};
};
action = [
{
service = "light.toggle";
target = {
entity_id = "light.4d_f7b4";
};
}
];
};
"automation remote press prime video" = {
alias = "remote press prime video";
trigger = {
platform = "event";
event_type = "esphome.hid_events";
event_data = {
usage = "161_0";
value = "1";
};
};
action = [
{
action = "media_player.select_source";
target.entity_id = media_player_entity;
data.source = "Prime Video";
}
];
};
"automation remote press netflix" = {
alias = "remote press netflix";
trigger = {
platform = "event";
event_type = "esphome.hid_events";
event_data = {
usage = "162_0";
value = "1";
};
};
action = [
{
action = "media_player.select_source";
target.entity_id = media_player_entity;
data.source = "Netflix";
}
];
};
};
}