From 962b6fa4feb5cb648b11d0efd5ad5c5df0915a48 Mon Sep 17 00:00:00 2001 From: Philipp Date: Thu, 18 Aug 2022 16:45:03 +0200 Subject: [PATCH] Big Update --- configuration.yaml | 0 lovelace/dashboard/harmony/harmony.yaml | 97 +++++++++++++++++++ .../dashboard/harmony/volume_control.yaml | 63 ++++++++++++ lovelace/dashboard/hello_world.yaml | 19 ++-- packages/door_sensors/door_sensors.yaml | 19 +--- packages/harmony/harmony.yaml | 56 +++++++++++ packages/harmony/netflix.yaml | 44 +++++++++ packages/harmony/turn_on_tv.yaml | 14 +++ packages/harmony/volume_control.yaml | 53 ++++++++++ packages/light/adaptive.yaml | 2 + packages/light/all_device_group.yaml | 9 ++ packages/light/buttons/automation.yaml | 20 +++- packages/light/buttons/group.yaml | 16 --- packages/light/livingroom_group.yaml | 8 ++ packages/mailbox/mailbox_received.yaml | 29 +++--- packages/mailbox/mailbox_taken_out.yaml | 33 ++++--- packages/mailbox/switch.yaml | 20 +++- packages/{sockets/socket.yaml => pc/pc.yaml} | 12 +++ packages/turn_off_everything.yaml | 73 ++++++++++++++ ui-lovelace.yaml | 15 ++- 20 files changed, 531 insertions(+), 71 deletions(-) mode change 100644 => 100755 configuration.yaml create mode 100755 lovelace/dashboard/harmony/harmony.yaml create mode 100755 lovelace/dashboard/harmony/volume_control.yaml create mode 100755 packages/harmony/harmony.yaml create mode 100755 packages/harmony/netflix.yaml create mode 100755 packages/harmony/turn_on_tv.yaml create mode 100755 packages/harmony/volume_control.yaml create mode 100755 packages/light/all_device_group.yaml delete mode 100755 packages/light/buttons/group.yaml create mode 100755 packages/light/livingroom_group.yaml rename packages/{sockets/socket.yaml => pc/pc.yaml} (62%) create mode 100755 packages/turn_off_everything.yaml diff --git a/configuration.yaml b/configuration.yaml old mode 100644 new mode 100755 diff --git a/lovelace/dashboard/harmony/harmony.yaml b/lovelace/dashboard/harmony/harmony.yaml new file mode 100755 index 0000000..1712b38 --- /dev/null +++ b/lovelace/dashboard/harmony/harmony.yaml @@ -0,0 +1,97 @@ +- type: 'custom:button-card' + template: card_title + name: TV + label: Control + +- type: vertical-stack + cards: + - type: horizontal-stack + cards: + - type: 'custom:button-card' + color_type: icon + color: rgb(229,9,20) + icon: "mdi:netflix" + size: 20% + tap_action: + action: call-service + service: script.turn_on + service_data: + entity_id: script.netflix_and_chill + name: Netflix + - type: 'custom:button-card' + color_type: icon + color: rgb(30,215,96) + icon: "mdi:spotify" + size: 20% + tap_action: + action: call-service + service: script.turn_on + service_data: + entity_id: script.denon_listen_music + name: Spotify + +- type: vertical-stack + cards: + - type: horizontal-stack + cards: + - type: 'custom:button-card' + color_type: icon + #color: rgb(229,9,20) + icon: "mdi:nintendo-switch" + size: 20% + tap_action: + action: call-service + service: script.turn_on + service_data: + entity_id: script.denon_play_switch + name: Nintendo Switch + - type: 'custom:button-card' + color_type: icon + color: rgb(51, 102, 255) + icon: "mdi:disc-player" + size: 20% + #tap_action: + # action: call-service + # service: script.turn_on + # service_data: + # entity_id: script.denon_listen_music + name: Blueray + +- type: vertical-stack + cards: + - type: horizontal-stack + cards: + - type: 'custom:button-card' + color_type: icon + color: rgb(0,173,238) + icon: "mdi:steam" + size: 20% + # tap_action: + # action: call-service + # service: script.turn_on + # service_data: + # entity_id: script.netflix_and_chill + name: Steam Link + - type: 'custom:button-card' + color_type: icon + color: rgb(144,138,153) + icon: "mdi:gamepad-square" + size: 20% + #tap_action: + # action: call-service + # service: script.turn_on + # service_data: + # entity_id: script.denon_listen_music + name: Super NT + + - type: 'custom:button-card' + color_type: icon + color: rgb(41, 61, 61) + icon: "mdi:television-off" + size: 10% + tap_action: + action: call-service + service: script.turn_on + service_data: + entity_id: script.denon_tv_turn_off + name: Turn Off \ No newline at end of file diff --git a/lovelace/dashboard/harmony/volume_control.yaml b/lovelace/dashboard/harmony/volume_control.yaml new file mode 100755 index 0000000..470e0a5 --- /dev/null +++ b/lovelace/dashboard/harmony/volume_control.yaml @@ -0,0 +1,63 @@ +- type: 'custom:button-card' + template: card_title + name: Volume + label: Control + +- type: horizontal-stack + cards: + - type: 'custom:button-card' + icon: "mdi:volume-minus" + size: 20% + tap_action: + action: call-service + service: script.turn_on + service_data: + entity_id: script.denon_volume_down + name: Down by 5 + - type: 'custom:button-card' + color_type: icon + color: rgb(255,0,0) + icon: "mdi:volume-mute" + size: 20% + tap_action: + action: call-service + service: script.turn_on + service_data: + entity_id: script.denon_volume_mute + name: Mute + - type: 'custom:button-card' + icon: "mdi:volume-plus" + size: 20% + tap_action: + action: call-service + service: script.turn_on + service_data: + entity_id: script.denon_volume_up + name: Up by 5 + +- type: 'custom:button-card' + template: card_title + label: Presets + +- type: horizontal-stack + cards: + - type: 'custom:button-card' + color_type: icon + icon: "mdi:television-classic" + size: 15% + tap_action: + action: call-service + service: script.turn_on + service_data: + entity_id: script.denon_volume_video + name: TV Volume + - type: 'custom:button-card' + color_type: icon + icon: "mdi:bookmark-music-outline" + size: 15% + tap_action: + action: call-service + service: script.turn_on + service_data: + entity_id: script.denon_volume_music + name: Music Volume \ No newline at end of file diff --git a/lovelace/dashboard/hello_world.yaml b/lovelace/dashboard/hello_world.yaml index 1f74c77..c4ad4d3 100755 --- a/lovelace/dashboard/hello_world.yaml +++ b/lovelace/dashboard/hello_world.yaml @@ -11,10 +11,20 @@ name: LivingRoom color: "blue" entity_2: - entity_id: sensor.livingroom_temp_temperature - icon: "mdi:lightbulb" #OPTIONAL - name: Temp + entity_id: script.netflix_and_chill + icon: "mdi:netflix" #OPTIONAL + name: Netflix + color: "red" + entity_3: + entity_id: script.denon_listen_music + icon: "mdi:spotify" #OPTIONAL + name: Spotify color: "green" + entity_4: + entity_id: script.denon_tv_turn_off + icon: "mdi:television-off" #OPTIONAL + name: TV OFF + color: "black" - type: 'custom:button-card' color_type: icon @@ -33,9 +43,6 @@ icon: mdi:mailbox-outline label: No Mail - - - - type: horizontal-stack cards: - type: "custom:button-card" diff --git a/packages/door_sensors/door_sensors.yaml b/packages/door_sensors/door_sensors.yaml index 65f945e..7ac4960 100755 --- a/packages/door_sensors/door_sensors.yaml +++ b/packages/door_sensors/door_sensors.yaml @@ -16,15 +16,6 @@ automation: data: message: reicht auch mit dem lüften! title: Badezimmer - #- service: notify.mobile_app_tonis_iphone - # data: - # message: reicht auch mit dem lüften! - # title: Badezimmer - - service: persistent_notification.create - data: - message: "Your message goes here" - title: "Custom subject" - notification_id: 1 #freezer open for 5 min - alias: livingroom_freezer_opened trigger: @@ -32,17 +23,13 @@ automation: domain: binary_sensor type: opened platform: device - entity_id: binary_sensor.bathroom_window_iaszone + entity_id: binary_sensor.livingroom_freezer_iaszone for: hours: 0 minutes: 5 seconds: 0 action: - - service: notify.mobile_app_sm_g998b + - service: notify.notify data: message: ist noch offen! - title: Freezer - - service: notify.mobile_app_tonis_iphone - data: - message: ist noch offen! - title: Freezer + title: Freezer \ No newline at end of file diff --git a/packages/harmony/harmony.yaml b/packages/harmony/harmony.yaml new file mode 100755 index 0000000..96889ed --- /dev/null +++ b/packages/harmony/harmony.yaml @@ -0,0 +1,56 @@ +script: + denon_listen_music: + sequence: + - service: media_player.turn_on + target: + device_id: 5ec213f0aedf10ff7fdff1d05ae6ead6 + - service: media_player.select_source + data: + source: HEOS Music + target: + entity_id: media_player.denon_avr_x1600h + - service: media_player.volume_set + data: + volume_level: 0.3 + target: + device_id: 5ec213f0aedf10ff7fdff1d05ae6ead6 + - service: remote.send_command + target: + device_id: 13079d62ad53d8991b26238c5594adca + data: + device: "75263914" + command: Play + + denon_play_switch: + sequence: + - service: script.turn_on + target: + entity_id: script.tv_turn_on + - service: media_player.turn_on + target: + device_id: 5ec213f0aedf10ff7fdff1d05ae6ead6 + - delay: + seconds: 5 + - service: media_player.select_source + data: + source: HEOS Music + target: + entity_id: media_player.denon_avr_x1600h + - service: remote.send_command + target: + device_id: 13079d62ad53d8991b26238c5594adca + data: + device: "78200006" + command: InputHdmi1 + + denon_tv_turn_off: + sequence: + - service: media_player.turn_off + target: + device_id: 5ec213f0aedf10ff7fdff1d05ae6ead6 + - service: light.turn_off + target: + entity_id: light.livingroom_switch_tv + + + \ No newline at end of file diff --git a/packages/harmony/netflix.yaml b/packages/harmony/netflix.yaml new file mode 100755 index 0000000..82e2f2a --- /dev/null +++ b/packages/harmony/netflix.yaml @@ -0,0 +1,44 @@ +script: + netflix_and_chill: + sequence: + - choose: + - conditions: + - condition: device + type: is_off + device_id: 53acbc86deb1bb16ca4c0889a78be5d2 + entity_id: light.livingroom_switch_tv + domain: light + sequence: + - service: script.turn_on + target: + entity_id: script.tv_turn_on + - service: script.turn_on + target: + entity_id: script.denon_watch_firetv + default: + - service: script.turn_on + target: + entity_id: script.denon_watch_firetv + mode: single + + denon_watch_firetv: + sequence: + - service: remote.send_command + target: + device_id: 13079d62ad53d8991b26238c5594adca + data: + device: "78200006" + command: InputHdmi2 + - service: media_player.turn_on + target: + device_id: 5ec213f0aedf10ff7fdff1d05ae6ead6 + - service: media_player.select_source + data: + source: Fire TV Stick + target: + entity_id: media_player.denon_avr_x1600h + - service: media_player.volume_set + data: + volume_level: 0.5 + target: + device_id: 5ec213f0aedf10ff7fdff1d05ae6ead6 \ No newline at end of file diff --git a/packages/harmony/turn_on_tv.yaml b/packages/harmony/turn_on_tv.yaml new file mode 100755 index 0000000..3d1cd3a --- /dev/null +++ b/packages/harmony/turn_on_tv.yaml @@ -0,0 +1,14 @@ +script: + tv_turn_on: + sequence: + - service: light.turn_on + target: + entity_id: light.livingroom_switch_tv + - delay: + seconds: 5 + - service: remote.send_command + target: + device_id: 13079d62ad53d8991b26238c5594adca + data: + device: "78200006" + command: PowerOn \ No newline at end of file diff --git a/packages/harmony/volume_control.yaml b/packages/harmony/volume_control.yaml new file mode 100755 index 0000000..7cdbd41 --- /dev/null +++ b/packages/harmony/volume_control.yaml @@ -0,0 +1,53 @@ +script: + denon_volume_up: + sequence: + - service: media_player.volume_set + entity_id: media_player.denon_avr_x1600h + data_template: + volume_level: "{{ state_attr('media_player.denon_avr_x1600h', 'volume_level') | float + 0.05 }}" + + denon_volume_down: + sequence: + - service: media_player.volume_set + entity_id: media_player.denon_avr_x1600h + data_template: + volume_level: "{{ state_attr('media_player.denon_avr_x1600h', 'volume_level') | float - 0.05 }}" + + denon_volume_video: + sequence: + - service: media_player.volume_set + data: + volume_level: 0.5 + target: + device_id: 5ec213f0aedf10ff7fdff1d05ae6ead6 + + denon_volume_music: + sequence: + - service: media_player.volume_set + data: + volume_level: 0.35 + target: + device_id: 5ec213f0aedf10ff7fdff1d05ae6ead6 + + denon_volume_mute: + variables: + entity_id: media_player.denon_avr_x1600h + sequence: + - choose: + - conditions: + - condition: template + value_template: '{{ state_attr(entity_id, ''is_volume_muted'') + == false }}' + sequence: + - service: media_player.volume_mute + data: + is_volume_muted: true + target: + entity_id: '{{ entity_id }}' + default: + - service: media_player.volume_mute + target: + entity_id: '{{ entity_id }}' + data: + is_volume_muted: false + mode: single \ No newline at end of file diff --git a/packages/light/adaptive.yaml b/packages/light/adaptive.yaml index 957ad88..bbdcb2a 100755 --- a/packages/light/adaptive.yaml +++ b/packages/light/adaptive.yaml @@ -1,6 +1,8 @@ adaptive_lighting: min_brightness: 35 + initial_transition: 0 transition: 0 + interval: 20 lights: - light.office_bulb - light.bedroom_bulb_light \ No newline at end of file diff --git a/packages/light/all_device_group.yaml b/packages/light/all_device_group.yaml new file mode 100755 index 0000000..59bad17 --- /dev/null +++ b/packages/light/all_device_group.yaml @@ -0,0 +1,9 @@ +# Example configuration.yaml entry +light: + - platform: group + name: "All Lights" + entities: + - light.bedroom_bulb_light + - light.livingroom_switch_tv + - light.office_bulb + - light.office_switch_socket \ No newline at end of file diff --git a/packages/light/buttons/automation.yaml b/packages/light/buttons/automation.yaml index a91233a..21560d4 100755 --- a/packages/light/buttons/automation.yaml +++ b/packages/light/buttons/automation.yaml @@ -26,7 +26,7 @@ automation: entity_id: light.bedroom_bulb_light domain: light # Office Button Light - - alias: office_light_button + - alias: office_light_button_single_press trigger: - device_id: ab68a51751fcc28c6576ba467a77581d domain: zha @@ -37,4 +37,20 @@ automation: - type: toggle device_id: ce016fbf6d9602740bbabe1fe9915c88 entity_id: light.office_bulb - domain: light \ No newline at end of file + domain: light + + # Office Button Light double press + - alias: office_light_button_double_press + trigger: + - device_id: ab68a51751fcc28c6576ba467a77581d + domain: zha + platform: device + type: remote_button_double_press + subtype: button + action: + - service: light.turn_on + target: + entity_id: light.office_bulb + data: + color_temp: 255 + brightness: 255 \ No newline at end of file diff --git a/packages/light/buttons/group.yaml b/packages/light/buttons/group.yaml deleted file mode 100755 index ae795d7..0000000 --- a/packages/light/buttons/group.yaml +++ /dev/null @@ -1,16 +0,0 @@ -#script: -# - name: Living Room Lights -# icon: "mdi:flower-tulip" -# entities: -# light.livingroom_switch_lamp_table: "toggle" -# light.livingroom_switch_lamp_couch: "toggle" -# light.living_room_switch_lamp_sill: "toggle" - -# Example configuration.yaml entry -light: - - platform: group - name: "Living Room Lights" - entities: - - light.livingroom_switch_lamp_table - - light.livingroom_switch_lamp_couch - - light.living_room_switch_lamp_sill \ No newline at end of file diff --git a/packages/light/livingroom_group.yaml b/packages/light/livingroom_group.yaml new file mode 100755 index 0000000..187c09c --- /dev/null +++ b/packages/light/livingroom_group.yaml @@ -0,0 +1,8 @@ +# Example configuration.yaml entry +light: + - platform: group + name: "Living Room Lights" + entities: + - light.livingroom_switch_lamp_table + - light.livingroom_switch_lamp_couch + - light.living_room_switch_lamp_sill diff --git a/packages/mailbox/mailbox_received.yaml b/packages/mailbox/mailbox_received.yaml index 67d8daa..836459c 100755 --- a/packages/mailbox/mailbox_received.yaml +++ b/packages/mailbox/mailbox_received.yaml @@ -23,16 +23,13 @@ automation: entity_id: switch.mailbox - service: scene.create data: - scene_id: before - snapshot_entities: - - light.office_bulb - - delay: - seconds: 2 - - service: scene.create - data: - scene_id: after - snapshot_entities: - - switch.adaptive_lighting_default + snapshot_entities: + - light.office_bulb + - switch.adaptive_lighting_default + scene_id: livingroom_office_bulb_state + - service: automation.turn_off + target: + entity_id: automation.light_save_last_state - service: switch.turn_off target: entity_id: switch.adaptive_lighting_default @@ -40,14 +37,18 @@ automation: target: entity_id: light.office_bulb data: - color_name: blue + rgb_color: [0,0,255] - delay: seconds: 15 - service: scene.turn_on target: - entity_id: scene.before + entity_id: scene.last_on_state - delay: - seconds: 1 + seconds: 0 + milliseconds: 500 - service: scene.turn_on target: - entity_id: scene.after \ No newline at end of file + entity_id: scene.livingroom_office_bulb_state + - service: automation.turn_on + target: + entity_id: automation.light_save_last_state \ No newline at end of file diff --git a/packages/mailbox/mailbox_taken_out.yaml b/packages/mailbox/mailbox_taken_out.yaml index 2052b23..dc5fa56 100755 --- a/packages/mailbox/mailbox_taken_out.yaml +++ b/packages/mailbox/mailbox_taken_out.yaml @@ -17,20 +17,16 @@ automation: entity_id: switch.mailbox - service: scene.create data: - scene_id: before - snapshot_entities: - - light.office_bulb - - automation.mailbox_mail_received + snapshot_entities: + - light.office_bulb + - switch.adaptive_lighting_default + scene_id: livingroom_office_bulb_state + - service: automation.turn_off + target: + entity_id: automation.light_save_last_state - service: automation.turn_off target: entity_id: automation.mailbox_mail_received - - service: scene.create - data: - scene_id: after - snapshot_entities: - - switch.adaptive_lighting_default - - delay: - seconds: 2 - service: switch.turn_off target: entity_id: switch.adaptive_lighting_default @@ -38,14 +34,21 @@ automation: target: entity_id: light.office_bulb data: - color_name: red + rgb_color: [0,0,255] - delay: seconds: 15 - service: scene.turn_on target: - entity_id: scene.before + entity_id: scene.last_on_state - delay: - seconds: 1 + seconds: 0 + milliseconds: 500 - service: scene.turn_on target: - entity_id: scene.after \ No newline at end of file + entity_id: scene.livingroom_office_bulb_state + - service: automation.turn_on + target: + entity_id: automation.light_save_last_state + - service: automation.turn_on + target: + entity_id: automation.mailbox_mail_received diff --git a/packages/mailbox/switch.yaml b/packages/mailbox/switch.yaml index 45cfdd2..2727a16 100755 --- a/packages/mailbox/switch.yaml +++ b/packages/mailbox/switch.yaml @@ -16,4 +16,22 @@ switch: mdi:mailbox {% else %} mdi:mailbox-outline - {% endif %} \ No newline at end of file + {% endif %} + +automation: + - alias: light_save_last_state + mode: single + trigger: + - platform: time_pattern + seconds: "10" + condition: + - condition: state + entity_id: light.office_bulb + state: "on" + action: + - service: scene.create + data: + snapshot_entities: + - light.office_bulb + - switch.adaptive_lighting_default + scene_id: last_on_state diff --git a/packages/sockets/socket.yaml b/packages/pc/pc.yaml similarity index 62% rename from packages/sockets/socket.yaml rename to packages/pc/pc.yaml index 6cf9f6d..c4c12bb 100755 --- a/packages/sockets/socket.yaml +++ b/packages/pc/pc.yaml @@ -1,3 +1,10 @@ +wake_on_lan: + +switch: + - platform: wake_on_lan + mac: !secret tower_mac + name: tower + #Office Steckdosenleiste automation: - alias: office_light_socket @@ -12,3 +19,8 @@ automation: device_id: 343b205f3ed48a715e59c5490050150f entity_id: light.office_switch_socket domain: light + - delay: + seconds: 15 + - service: switch.turn_on + target: + entity_id: switch.tower diff --git a/packages/turn_off_everything.yaml b/packages/turn_off_everything.yaml new file mode 100755 index 0000000..5afba11 --- /dev/null +++ b/packages/turn_off_everything.yaml @@ -0,0 +1,73 @@ +# automation: +# - alias: turn_off_everything +# mode: single +# trigger: +# - platform: time +# at: "02:00:00" +# action: +# # inside a automation actions or script sequence +# - alias: "Set up variables for the actions" +# variables: +# # Including an id in the action allows us to identify this script run +# # and not accidentally trigger for other notification actions +# action_turn_off: "{{ 'OFF_' ~ context.id }}" +# action_turn_off_later: "{{ 'LATER_' ~ context.id }}" +# - alias: "Ask to turn off everything" +# service: notify.mobile_app_sm_g998b +# data: +# message: "Do you want to turn off the lights" +# data: +# actions: +# - action: "{{ action_turn_off }}" +# title: Turn off +# - action: "{{ action_turn_off_later }}" +# title: Turn off later +# - alias: "Wait for a response" +# wait_for_trigger: +# - platform: event +# event_type: mobile_app_notification_action +# event_data: +# # waiting for the specific action avoids accidentally continuing +# # for another script/automation's notification action +# action: "{{ action_turn_off }}" +# - platform: event +# event_type: mobile_app_notification_action +# event_data: +# action: "{{ action_turn_off_later }}" + +# - alias: "Perform the action" +# choose: +# - conditions: "{{ wait.trigger.event.data.action == action_turn_off }}" +# sequence: +# - service: homeassistant.turn_off +# target: +# entity_id: light.living_room_lights +# #- service: homeassistant.turn_off +# # target: +# # entity_id: light.all_lights +# - conditions: "{{ wait.trigger.event.data.action == action_turn_off_later }}" +# sequence: +# - service: cover.close_cover +# target: +# entity_id: cover.some_cover + + + + + + + # - alias: turn_off_everything + # trigger: + # - platform: time + # at: "15:00:00" + # action: + # - service: notify.mobile_app_sm_g998b + # data: + # message: "Something happened at home!" + # data: + # actions: + # - action: "REPLY" + # title: "Sound Alarm" + # - action: "URI" + # title: "Open Url" + # uri: "https://google.com" \ No newline at end of file diff --git a/ui-lovelace.yaml b/ui-lovelace.yaml index fab67d4..671a7f7 100755 --- a/ui-lovelace.yaml +++ b/ui-lovelace.yaml @@ -26,8 +26,21 @@ views: cards: !include lovelace/dashboard/sensors.yaml - type: custom:vertical-layout - title: "Kunibert" + title: "TV Remote" path: 1 + cards: + - type: custom:vertical-layout + type: vertical-stack + cards: + !include lovelace/dashboard/harmony/harmony.yaml + - type: custom:layout-break + - type: custom:vertical-layout + type: vertical-stack + cards: + !include lovelace/dashboard/harmony/volume_control.yaml + - type: custom:vertical-layout + title: "Kunibert" + path: 2 cards: - type: custom:vertical-layout type: vertical-stack