From 5b60b0ffc288953483812463b86f548d936a060b Mon Sep 17 00:00:00 2001 From: Georgi Gardev Date: Thu, 8 Dec 2022 21:36:21 +0200 Subject: [PATCH] Add christmas lights --- configuration.yaml | 20 ++++ .../home_dashboard/living_room_dashboard.yaml | 8 ++ .../home_dashboard/preferences_dashboard.yaml | 15 +++ lovelace/popup_cards.yaml | 107 ++++++++++++++++++ packages/devices/living_room/isparkle.yaml | 50 ++++++++ packages/routines/good_night.yaml | 1 + packages/routines/waking_up.yaml | 1 + 7 files changed, 202 insertions(+) create mode 100644 packages/devices/living_room/isparkle.yaml diff --git a/configuration.yaml b/configuration.yaml index a570e4d..526cfd7 100644 --- a/configuration.yaml +++ b/configuration.yaml @@ -164,3 +164,23 @@ media_extractor: # https://www.home-assistant.io/integrations/mobile_app mobile_app: + +rest_command: + isparkle_on: + url: "http://192.168.0.13:1338/on" + method: "POST" + content_type: "application/x-www-form-urlencoded" + isparkle_off: + url: "http://192.168.0.13:1338/off" + method: "POST" + content_type: "application/x-www-form-urlencoded" + isparkle_fade: + url: "http://192.168.0.13:1338/fade" + method: "POST" + content_type: "application/x-www-form-urlencoded" + payload: "color={{ color }}&fadeInTime={{ fadeInTime }}&&fadeOutTime={{ fadeOutTime }}" + isparkle_set: + url: "http://192.168.0.13:1338/set" + method: "POST" + content_type: "application/x-www-form-urlencoded" + payload: "color={{ color }}&fn={{ fn }}&brightness1={{ brightness1 }}&timing1={{ timing1 }}&brightness2={{ brightness2 }}&timing2={{ timing2 }}" diff --git a/lovelace/home_dashboard/living_room_dashboard.yaml b/lovelace/home_dashboard/living_room_dashboard.yaml index 67cc5d2..8b9c9c0 100644 --- a/lovelace/home_dashboard/living_room_dashboard.yaml +++ b/lovelace/home_dashboard/living_room_dashboard.yaml @@ -119,6 +119,14 @@ show_state: false tap_action: action: more-info + - type: custom:button-card + template: v3_button + entity: input_select.isparkle_color + name: Christmas lights + icon: mdi:string-lights + show_state: false + tap_action: + action: more-info - type: vertical-stack cards: diff --git a/lovelace/home_dashboard/preferences_dashboard.yaml b/lovelace/home_dashboard/preferences_dashboard.yaml index 481a11a..c0041cf 100644 --- a/lovelace/home_dashboard/preferences_dashboard.yaml +++ b/lovelace/home_dashboard/preferences_dashboard.yaml @@ -103,6 +103,21 @@ - automation.tv_plex_setup_house_for_plex - automation.tv_plex_restore_house_after_plex + - type: custom:decluttering-card + template: v3_section_title + variables: + - title: Christmas lights + - type: entities + entities: + - rest_command.isparkle_on + - rest_command.isparkle_off + - input_select.isparkle_color + - input_select.isparkle_fade + - input_number.isparkle_brightness_1 + - input_number.isparkle_fade_1 + - input_number.isparkle_brightness_2 + - input_number.isparkle_fade_2 + - type: vertical-stack cards: - type: custom:decluttering-card diff --git a/lovelace/popup_cards.yaml b/lovelace/popup_cards.yaml index 1fb2a31..367d471 100644 --- a/lovelace/popup_cards.yaml +++ b/lovelace/popup_cards.yaml @@ -939,3 +939,110 @@ cards: show_state: false tap_action: action: toggle + + - type: custom:popup-card + entity: input_select.isparkle_color + title: "Christmas lights" + card: + type: vertical-stack + cards: + - type: horizontal-stack + cards: + - type: custom:button-card + template: v3_button + icon: mdi:string-lights + name: "On" + show_state: false + tap_action: + action: call-service + service: rest_command.isparkle_on + - type: custom:button-card + template: v3_button + name: "Off" + icon: mdi:string-lights-off + show_state: false + tap_action: + action: call-service + service: rest_command.isparkle_off + - type: horizontal-stack + cards: + - type: custom:button-card + template: v3_tablet_button + name: "Fade white" + icon: mdi:string-lights + show_state: false + tap_action: + action: call-service + service: rest_command.isparkle_fade + service_data: + color: white + fadeInTime: 20 + fadeOutTime: 20 + - type: custom:button-card + template: v3_tablet_button + name: "Fade white slow" + icon: mdi:string-lights + show_state: false + tap_action: + action: call-service + service: rest_command.isparkle_fade + service_data: + color: white + fadeInTime: 100 + fadeOutTime: 100 + - type: custom:button-card + template: v3_tablet_button + name: "Fade color" + icon: mdi:string-lights + show_state: false + tap_action: + action: call-service + service: rest_command.isparkle_fade + service_data: + color: mix + fadeInTime: 20 + fadeOutTime: 20 + - type: custom:button-card + template: v3_tablet_button + name: "Fade color slow" + icon: mdi:string-lights + show_state: false + tap_action: + action: call-service + service: rest_command.isparkle_fade + service_data: + color: mix + fadeInTime: 100 + fadeOutTime: 100 + - type: horizontal-stack + cards: + - type: custom:button-card + template: v3_tablet_button + name: "Static white" + icon: mdi:string-lights + show_state: false + tap_action: + action: call-service + service: rest_command.isparkle_set + service_data: + color: white + fn: solid + brightness1: 10 + brightness2: 10 + timing1: 0 + timing2: 0 + - type: custom:button-card + template: v3_tablet_button + name: "Static color" + icon: mdi:string-lights + show_state: false + tap_action: + action: call-service + service: rest_command.isparkle_set + service_data: + color: mix + fn: solid + brightness1: 10 + brightness2: 10 + timing1: 0 + timing2: 0 diff --git a/packages/devices/living_room/isparkle.yaml b/packages/devices/living_room/isparkle.yaml new file mode 100644 index 0000000..2da7210 --- /dev/null +++ b/packages/devices/living_room/isparkle.yaml @@ -0,0 +1,50 @@ +input_select: + isparkle_color: + name: Christmas lights color + options: + - mix + - white + isparkle_fade: + name: Christmas lights fade + options: + - fade + - solid + +input_number: + isparkle_fade_1: + name: Christmas lights fade 1 + min: 0 + max: 999 + isparkle_fade_2: + name: Christmas lights fade 2 + min: 0 + max: 999 + isparkle_brightness_1: + name: Christmas lights brightness 1 + min: 0 + max: 10 + isparkle_brightness_2: + name: Christmas lights brightness 2 + min: 0 + max: 10 + +automation: + - alias: Christmas lights change + trigger: + - platform: state + entity_id: + - input_select.isparkle_color + - input_select.isparkle_fade + - input_number.isparkle_fade_1 + - input_number.isparkle_fade_2 + - input_number.isparkle_brightness_1 + - input_number.isparkle_brightness_2 + action: + service: rest_command.isparkle_set + data_template: + color: "{{ states('input_select.isparkle_color') }}" + fn: "{{ states('input_select.isparkle_fade') }}" + brightness1: "{{ states('input_number.isparkle_brightness_1') | int }}" + timing1: "{{ states('input_number.isparkle_fade_1') | int}}" + brightness2: "{{ states('input_number.isparkle_brightness_2') | int }}" + timing2: "{{ states('input_number.isparkle_fade_2') | int }}" diff --git a/packages/routines/good_night.yaml b/packages/routines/good_night.yaml index df0441c..3e647b1 100644 --- a/packages/routines/good_night.yaml +++ b/packages/routines/good_night.yaml @@ -21,6 +21,7 @@ script: - service: light.turn_off entity_id: light.master_bedroom - service: script.living_room_candle_off + - service: rest_command.isparkle_off routine_good_night: alias: Routine ยท Going to sleep diff --git a/packages/routines/waking_up.yaml b/packages/routines/waking_up.yaml index 2bfab70..def472e 100644 --- a/packages/routines/waking_up.yaml +++ b/packages/routines/waking_up.yaml @@ -24,6 +24,7 @@ script: entity_id: - light.living_room_ambient + - service: rest_command.isparkle_on - service: script.open_living_room_cover - service: script.shield_screensaver