From 57a215fec4b1d156d8e3a65146db4f552dd761a5 Mon Sep 17 00:00:00 2001 From: Dominik Polakovics Date: Sun, 18 Feb 2024 22:39:03 +0100 Subject: [PATCH] change to lights and multimedia home-assistant --- .../modules/home-assistant/light.nix | 10 ++-- .../modules/home-assistant/multimedia.nix | 56 ++++++++++++++++--- 2 files changed, 54 insertions(+), 12 deletions(-) diff --git a/hosts/fw.cloonar.com/modules/home-assistant/light.nix b/hosts/fw.cloonar.com/modules/home-assistant/light.nix index 7e06157..85bae9d 100644 --- a/hosts/fw.cloonar.com/modules/home-assistant/light.nix +++ b/hosts/fw.cloonar.com/modules/home-assistant/light.nix @@ -129,27 +129,27 @@ ]; } { - conditions = [ "{{ state_attr('sun.sun', 'elevation') < 5 and trigger.entity_id == 'light.kitchen_lights' }}" ]; + conditions = [ "{{ state_attr('sun.sun', 'elevation') < 5 and trigger.entity_id == 'light.bedroom_lights' }}" ]; sequence = [ { service = "light.turn_on"; target = { - entity_id = "light.kitchen_lights"; + entity_id = "light.bedroom_lights"; }; data = { - brightness_pct = 30; + brightness_pct = 5; color_temp = 450; }; } ]; } { - conditions = [ "{{ state_attr('sun.sun', 'elevation') < 5 and state_attr(trigger.entity_id, 'is_deconz_group') != None }}" ]; + conditions = [ "{{ state_attr('sun.sun', 'elevation') < 5 and trigger.entity_id == 'light.kitchen_lights' }}" ]; sequence = [ { service = "light.turn_on"; target = { - entity_id = "{{ trigger.entity_id }}"; + entity_id = "light.kitchen_lights"; }; data = { brightness_pct = 30; diff --git a/hosts/fw.cloonar.com/modules/home-assistant/multimedia.nix b/hosts/fw.cloonar.com/modules/home-assistant/multimedia.nix index 70d6898..76f1c4a 100644 --- a/hosts/fw.cloonar.com/modules/home-assistant/multimedia.nix +++ b/hosts/fw.cloonar.com/modules/home-assistant/multimedia.nix @@ -1,4 +1,8 @@ { + services.home-assistant.extraComponents = [ + "broadlink" + "androidtv" + ]; services.home-assistant.config = { # binary_sensor = [ # { @@ -232,13 +236,51 @@ delay = 5; } { - 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"; - }; + 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="; + }; + } + ]; + } + ]; } ]; };