{ services.home-assistant.extraComponents = [ "broadlink" "androidtv" ]; services.home-assistant.config = { # binary_sensor = [ # { # name = "ps5_living"; # platform = "command_line"; # command = "python /var/lib/hass/ps5.py -q -b 10.42.96.176"; # device_class = "connectivity"; # scan_interval = 5; # } # { # platform = "template"; # sensors = { # multimedia_device_on = { # friendly_name = "Any multimedia device on"; # device_class = "connectivity"; # value_template = '' # {% if is_state('binary_sensor.ps5_living', 'on') or states('media_player.fire_tv_firetv_living_cloonar_com') != 'off' or states('device_tracker.xbox') == 'home' %} # on # {% else %} # off # {% endif %} # ''; # }; # }; # } # ]; # "automation tv scene" = { # alias = "auto tv scene"; # hide_entity = true; # trigger = { # platform = "event"; # event_type = "button_pressed"; # event_data = { # id = [ 254 235 105 198 ]; # }; # }; # action = { # service_template = "switch.turn_on"; # data_template = { # entity_id = "switch.computer"; # }; # }; # }; # "automation beamer switch" = { # alias = "auto beamer scene"; # hide_entity = true; # trigger = { # platform = "state"; # entity_id = "sensor.computer_power"; # }; # condition = { # condition = "and"; # conditions = [ # { # condition = "numeric_state"; # entity_id = "sensor.computer_power"; # below = 15; # } # "{{ (as_timestamp(now()) - as_timestamp(states.switch.computer.last_changed)) > 300 }}" # ]; # }; # action = { # service = "switch.turn_off"; # target = { # entity_id = [ "switch.computer" ]; # }; # }; # }; "automation xbox on" = { alias = "xbox on"; hide_entity = true; trigger = { platform = "state"; entity_id = "device-tracker.xbox"; to = "home"; }; action = [ { service = "media_player.select_source"; target = { entity_id = "media_player.marantz_sr6015"; }; data = { source = "Xbox"; }; } { delay = 5; } { service = "denonavr.get_command"; target = { entity_id = "media_player.marantz_sr6015"; }; data = { command = "/goform/formiPhoneAppDirect.xml?PWSTANDBY"; }; } ]; }; "automation firetv on" = { alias = "firetv on"; hide_entity = true; trigger = { platform = "state"; entity_id = "media_player.fire_tv_firetv_living_cloonar_com"; from = "off"; }; action = [ { service = "denonavr.get_command"; target = { entity_id = "media_player.marantz_sr6015"; }; data = { command = "/goform/formiPhoneAppDirect.xml?SIMPLAY"; }; } { delay = 5; } { service = "denonavr.get_command"; target = { entity_id = "media_player.marantz_sr6015"; }; data = { command = "/goform/formiPhoneAppDirect.xml?PWSTANDBY"; }; } ]; }; # "automation ps5 on" = { # alias = "ps5 on"; # hide_entity = true; # trigger = { # platform = "state"; # entity_id = "binary_sensor.ps5_living"; # to = "on"; # }; # action = [ # { # service = "denonavr.get_command"; # target = { # entity_id = "media_player.marantz_sr6015"; # }; # data = { # command = "/goform/formiPhoneAppDirect.xml?SIBD"; # }; # } # { # delay = 5; # } # { # service = "denonavr.get_command"; # target = { # entity_id = "media_player.marantz_sr6015"; # }; # data = { # command = "/goform/formiPhoneAppDirect.xml?PWSTANDBY"; # }; # } # ]; # }; "automation all multimedia off" = { alias = "all multimedia off"; trigger = { platform = "state"; entity_id = "binary_sensor.multimedia_device_on"; to = "off"; }; action = [ { conditions = [ "{{ states('media_player.android_tv_metz_cloonar_com') != 'off'}}" ]; sequence = [ { service = "androidtv.adb_command"; target = { device_id = "a5e50f268f3a2dbd0741fb8e9ff7f931"; }; data = { command = "POWER"; }; } ]; } { service = "denonavr.get_command"; target = { entity_id = "media_player.marantz_sr6015"; }; data = { command = "/goform/formiPhoneAppDirect.xml?PWSTANDBY"; }; } ]; }; "automation all_multimedia_on" = { alias = "all multimedia on"; trigger = { platform = "state"; entity_id = "binary_sensor.multimedia_device_on"; to = "on"; }; condition = { condition = "or"; conditions = [ { condition = "state"; entity_id = "media_player.android_tv_metz_cloonar_com"; state = "off"; } { condition = "state"; entity_id = "media_player.android_tv_metz_cloonar_com"; state = "unavailable"; } ]; }; action = [ { service = "androidtv.adb_command"; target = { device_id = "a5e50f268f3a2dbd0741fb8e9ff7f931"; }; data = { command = "POWER"; }; } { delay = 5; } { choose = [ { conditions = [ { condition = "state"; entity_id = "media_player.android_tv_metz_cloonar_com"; state = "off"; } ]; sequence = [ { service = "androidtv.adb_command"; target = { device_id = "a5e50f268f3a2dbd0741fb8e9ff7f931"; }; data = { command = "adb shell am start -a android.intent.action.VIEW -d content://android.media.tv/passthrough/com.mediatek.tvinput%2F.hdmi.HDMIInputService%2FHDMI100004"; }; } ]; } { conditions = [ { condition = "state"; entity_id = "media_player.android_tv_metz_cloonar_com"; state = "unavailable"; } ]; sequence = [ { service = "remote.send_command"; target = { device_id = "46988d2d424728f7355fe12b09e88e0e"; }; data = { num_repeats = 1; delay_secs = 0.4; hold_secs = 0; command = "b64:JgBOAJaSFREVNRU2FTUVERURFRAVERURFTUVNhU1FREVERUQFREVERUQFTYVNRURFREVEBURFTYVNRURFRAVNhU1FTYVNRUABfmWkhURFQANBQAAAAAAAAAAAAA="; }; } ]; } ]; } ]; }; # "automation multimedia input" = { # hide_entity = true; # trigger = { # platform = "state"; # entity_id = "sensor.computer_power"; # }; # condition = { # condition = "and"; # conditions = [ # { # condition = "numeric_state"; # entity_id = "sensor.computer_power"; # below = 15; # } # "{{ (as_timestamp(now()) - as_timestamp(states.switch.computer.last_changed)) > 300 }}" # ]; # }; # action = { # service = "switch.turn_off"; # target = { # entity_id = [ "switch.computer" ]; # }; # }; # }; }; }