From b9b9f14ead90c99f5d0cb80722cd416d6139651f Mon Sep 17 00:00:00 2001 From: Mahasri Kalavala Date: Sun, 10 Jan 2021 18:15:03 -0500 Subject: [PATCH] minor fixes --- configuration.yaml | 3 +- lovelace/01_lights_view.yaml | 2 +- lovelace/03_camera_view.yaml | 20 +++++- packages/cameras.yaml | 113 +++++++++++++++++++++++++++++++++- packages/daily_routines.yaml | 8 +-- packages/homeassistant.yaml | 1 - packages/lights_switches.yaml | 4 +- packages/scripts.yaml | 95 ---------------------------- packages/watchdog.yaml | 4 +- packages/weather.yaml | 2 + templates/away_status.yaml | 2 +- templates/goodnight.yaml | 2 +- 12 files changed, 145 insertions(+), 111 deletions(-) diff --git a/configuration.yaml b/configuration.yaml index a1546c2..0c2cbc3 100644 --- a/configuration.yaml +++ b/configuration.yaml @@ -17,13 +17,14 @@ homeassistant: allowlist_external_dirs: - /config/www/downloads/camera/patio/ + - /config/www/downloads/camera/porch/ - /config/www/downloads/camera/garage/ - /config/www/downloads/camera/playarea/ - /config/www/downloads/camera/driveway/ - /config/www/downloads/camera/frontdoor/ - /config/www/downloads/camera/kitchen/ - /config/www/downloads/camera/frontroom/ - - /config/www/downloads/camera/3dprinter/ + - /config/www/downloads/camera/3d/ sun: alexa: diff --git a/lovelace/01_lights_view.yaml b/lovelace/01_lights_view.yaml index b54626c..29cd4db 100644 --- a/lovelace/01_lights_view.yaml +++ b/lovelace/01_lights_view.yaml @@ -82,4 +82,4 @@ cards: show_header_toggle: true entities: - switch.frontyard_light - - switch.wemobackyardlightswitch + - switch.backyard_light diff --git a/lovelace/03_camera_view.yaml b/lovelace/03_camera_view.yaml index 7f01c8f..55032ed 100644 --- a/lovelace/03_camera_view.yaml +++ b/lovelace/03_camera_view.yaml @@ -51,6 +51,22 @@ cards: domain: script action: stream_patio_camera_to_chromecast + - type: "custom:button-card" + name: Porch + entity: input_label.current_stream + icon: mdi:cctv + color_type: card + style: + - font-weight: bold + - color: rgb(0, 0, 5) + state: + - value: "porch" + color: var(--primary-color) + action: service + service: + domain: script + action: stream_porch_camera_to_chromecast + - type: "custom:button-card" name: Playarea entity: input_label.current_stream @@ -105,7 +121,7 @@ cards: tap_action: action: more-info entities: - - switch.wemobackyardlightswitch + - switch.backyard_light - binary_sensor.patio_camera_motion - type: picture-glance @@ -129,7 +145,7 @@ cards: tap_action: action: more-info entities: - - switch.wemobackyardlightswitch + - switch.backyard_light - binary_sensor.playarea_camera_motion - type: picture-glance diff --git a/packages/cameras.yaml b/packages/cameras.yaml index a398fad..ef1d217 100644 --- a/packages/cameras.yaml +++ b/packages/cameras.yaml @@ -1051,7 +1051,7 @@ automation: - platform: time_pattern minutes: "/15" action: - - service_template: "script.{{- ['driveway', 'patio', 'playarea'] | random -}}_cam" + - service_template: "script.{{- ['driveway', 'patio', 'playarea', 'porch'] | random -}}_cam" script: frontdoor_cam: @@ -1078,8 +1078,119 @@ script: data_template: url: !secret playarea_camera_stream_url name: "playarea" + porch_cam: + sequence: + - service: script.stream2chromecast + data_template: + url: !secret porch_camera_stream_url + name: "porch" + reset_camera_stream: alias: Reset Camera Stream sequence: - service: shell_command.reset_camera_stream - service_template: "script.{{- ['frontdoor', 'driveway', 'patio', 'playarea'] | random -}}_cam" + + ############################################################################### + # On-Demand camera stream to chromecast scripts + # + stream_frontdoor_camera_to_chromecast: + sequence: + - condition: template + value_template: "{{ states('input_boolean.stream_camera2chromecast') == 'on' }}" + - service: script.stream2chromecast + data_template: + url: !secret frontdoor_camera_stream_url + name: "frontyard" + + stream_driveway_camera_to_chromecast: + sequence: + - condition: template + value_template: "{{ states('input_boolean.stream_camera2chromecast') == 'on' }}" + - service: script.stream2chromecast + data_template: + url: !secret driveway_camera_stream_url + name: "driveway" + + stream_patio_camera_to_chromecast: + sequence: + - condition: template + value_template: "{{ states('input_boolean.stream_camera2chromecast') == 'on' }}" + - service: script.stream2chromecast + data_template: + url: !secret patio_camera_stream_url + name: "patio" + + stream_playarea_camera_to_chromecast: + sequence: + - condition: template + value_template: "{{ states('input_boolean.stream_camera2chromecast') == 'on' }}" + - service: script.stream2chromecast + data_template: + url: !secret playarea_camera_stream_url + name: "playarea" + + stream_porch_camera_to_chromecast: + sequence: + - condition: template + value_template: "{{ states('input_boolean.stream_camera2chromecast') == 'on' }}" + - service: script.stream2chromecast + data_template: + url: !secret porch_camera_stream_url + name: "porch" + + ############################################################################### + # _____ ____ _ + # / ____| / __ \ | | + # | | __ _ _ __ ___ ___ _ __ __ _ | | | |_ _____ _ __| | __ _ _ _ + # | | / _` | '_ ` _ \ / _ \ '__/ _` | | | | \ \ / / _ \ '__| |/ _` | | | | + # | |___| (_| | | | | | | __/ | | (_| | | |__| |\ V / __/ | | | (_| | |_| | + # \_____\__,_|_| |_| |_|\___|_| \__,_| \____/ \_/ \___|_| |_|\__,_|\__, | + # __/ | + # |___/ + # + # Camera Text Overlay Script - sets a given text as an overlay on camera feed + ############################################################################### + frontdoor_camera_text_overlay: + sequence: + - service: rest_command.set_frontdoor_camera_text_left_bottom + data_template: + message: "{{text}}" + + driveway_camera_text_overlay: + sequence: + - service: rest_command.set_driveway_camera_text_left_bottom + data_template: + message: "{{text}}" + + patio_camera_text_overlay: + sequence: + - service: rest_command.set_patio_camera_text_left_bottom + data_template: + message: "{{text}}" + + playarea_camera_text_overlay: + sequence: + - service: rest_command.set_playarea_camera_text_left_bottom + data_template: + message: "{{text}}" + + ############################################################################### + # Stream2Chromecast script streams a given URL to Chromecast + # But before it streams, it turns ON the media player if it is OFF, and after + # streaming the URL, it saves the current stream name + # BY calling media_player.turn_off, it forces Chromecast stream onto be active + # on TV as soon as it turns ON TV + stream2chromecast: + sequence: + - condition: template + value_template: "{{ states('input_label.current_stream') != name }}" + - service: media_player.play_media + data_template: + entity_id: media_player.attic_tv + media_content_id: "{{ url }}" + media_content_type: "video" + - service: input_label.set_value + data_template: + entity_id: input_label.current_stream + value: "{{ name }}" \ No newline at end of file diff --git a/packages/daily_routines.yaml b/packages/daily_routines.yaml index cb2d213..dbbb9d0 100644 --- a/packages/daily_routines.yaml +++ b/packages/daily_routines.yaml @@ -108,9 +108,9 @@ automation: state: "on" action: - service: switch.turn_off - entity_id: switch.frontyard + entity_id: switch.frontyard_light - service: switch.turn_off - entity_id: switch.backyard + entity_id: switch.backyard_light ############################################################################### # Turn OF Kitchen Lights after 3 hours of wake up time during school/work days @@ -162,9 +162,9 @@ automation: state: "on" action: - service: switch.turn_on - entity_id: switch.frontyard + entity_id: switch.frontyard_light - service: switch.turn_on - entity_id: switch.backyard + entity_id: switch.backyard_light ############################################################################### # Turn indoor lights on 30 minutes before sunset diff --git a/packages/homeassistant.yaml b/packages/homeassistant.yaml index abace18..dbc7f99 100644 --- a/packages/homeassistant.yaml +++ b/packages/homeassistant.yaml @@ -27,7 +27,6 @@ speedtestdotnet: sensor: - platform: uptime name: Home Assistant Up Time - unit_of_measurement: hours - platform: rest resource: http://icanhazip.com diff --git a/packages/lights_switches.yaml b/packages/lights_switches.yaml index 2eeca81..143b385 100644 --- a/packages/lights_switches.yaml +++ b/packages/lights_switches.yaml @@ -6,7 +6,7 @@ ############################################################################### homeassistant: customize: - switch.frontyard: + switch.frontyard_light: icon: mdi:lightbulb friendly_name: Front Porch Lights emulated_hue_name: Front Yard Lights @@ -18,7 +18,7 @@ homeassistant: emulated_hue_name: Wemo Outlet homebridge_name: Wemo Outlet - switch.backyard: + switch.backyard_light: icon: mdi:lightbulb friendly_name: Backyard Lights emulated_hue_name: Backyard Lights diff --git a/packages/scripts.yaml b/packages/scripts.yaml index a9c39d7..a4dac2e 100644 --- a/packages/scripts.yaml +++ b/packages/scripts.yaml @@ -124,101 +124,6 @@ script: - switch.upstairs_fragrance - switch.officeroom_accent_lights - ############################################################################### - # _____ ____ _ - # / ____| / __ \ | | - # | | __ _ _ __ ___ ___ _ __ __ _ | | | |_ _____ _ __| | __ _ _ _ - # | | / _` | '_ ` _ \ / _ \ '__/ _` | | | | \ \ / / _ \ '__| |/ _` | | | | - # | |___| (_| | | | | | | __/ | | (_| | | |__| |\ V / __/ | | | (_| | |_| | - # \_____\__,_|_| |_| |_|\___|_| \__,_| \____/ \_/ \___|_| |_|\__,_|\__, | - # __/ | - # |___/ - # - # Camera Text Overlay Script - sets a given text as an overlay on camera feed - ############################################################################### - frontdoor_camera_text_overlay: - sequence: - - service: rest_command.set_frontdoor_camera_text_left_bottom - data_template: - message: "{{text}}" - - driveway_camera_text_overlay: - sequence: - - service: rest_command.set_driveway_camera_text_left_bottom - data_template: - message: "{{text}}" - - patio_camera_text_overlay: - sequence: - - service: rest_command.set_patio_camera_text_left_bottom - data_template: - message: "{{text}}" - - playarea_camera_text_overlay: - sequence: - - service: rest_command.set_playarea_camera_text_left_bottom - data_template: - message: "{{text}}" - - ############################################################################### - # On-Demand camera stream to chromecast scripts - # - stream_frontdoor_camera_to_chromecast: - sequence: - - condition: template - value_template: "{{ states('input_boolean.stream_camera2chromecast') == 'on' }}" - - service: script.stream2chromecast - data_template: - url: !secret frontdoor_camera_stream_url - name: "frontyard" - - stream_driveway_camera_to_chromecast: - sequence: - - condition: template - value_template: "{{ states('input_boolean.stream_camera2chromecast') == 'on' }}" - - service: script.stream2chromecast - data_template: - url: !secret driveway_camera_stream_url - name: "driveway" - - stream_patio_camera_to_chromecast: - sequence: - - condition: template - value_template: "{{ states('input_boolean.stream_camera2chromecast') == 'on' }}" - - service: script.stream2chromecast - data_template: - url: !secret patio_camera_stream_url - name: "patio" - - stream_playarea_camera_to_chromecast: - sequence: - - condition: template - value_template: "{{ states('input_boolean.stream_camera2chromecast') == 'on' }}" - - service: script.stream2chromecast - data_template: - url: !secret playarea_camera_stream_url - name: "playarea" - - ############################################################################### - # Stream2Chromecast script streams a given URL to Chromecast - # But before it streams, it turns ON the media player if it is OFF, and after - # streaming the URL, it saves the current stream name - # BY calling media_player.turn_off, it forces Chromecast stream onto be active - # on TV as soon as it turns ON TV - stream2chromecast: - sequence: - - condition: template - value_template: "{{ states('input_label.current_stream') != name }}" - - service: media_player.play_media - data_template: - entity_id: media_player.attic_tv - media_content_id: "{{ url }}" - media_content_type: "video" - - service: input_label.set_value - data_template: - entity_id: input_label.current_stream - value: "{{ name }}" - stop_hass: sequence: - service: shell_command.stop_hass diff --git a/packages/watchdog.yaml b/packages/watchdog.yaml index 6b1de35..fdd5dde 100644 --- a/packages/watchdog.yaml +++ b/packages/watchdog.yaml @@ -82,8 +82,8 @@ automation: trigger: - platform: state entity_id: - - switch.backyard - - switch.frontyard + - switch.backyard_light + - switch.frontyard_light to: "on" for: minutes: 5 diff --git a/packages/weather.yaml b/packages/weather.yaml index 94f2785..2a8eb0a 100644 --- a/packages/weather.yaml +++ b/packages/weather.yaml @@ -242,6 +242,8 @@ automation: input_boolean.super_heavy_wind_alert {%- elif ( windspeed > 60 ) %} input_boolean.hurricane_wind_alert + {% else %} + input_boolean.dummy {%- endif %} # #Turn off those wind speed alert booleans automatically after 15 minutes. diff --git a/templates/away_status.yaml b/templates/away_status.yaml index 4fced2d..9eeb38f 100644 --- a/templates/away_status.yaml +++ b/templates/away_status.yaml @@ -94,7 +94,7 @@ "switch.kids_bedroom", "switch.kitchen", "switch.office_room", - "switch.wemobackyardlightswitch"] %} + "switch.backyard_light"] %} {% for item in lights_switches -%} {%- if states[item.split('.')[0]][item.split('.')[1]].state == "on" -%} {%- set friendly_name = states[item.split('.')[0]][item.split('.')[1]].attributes.friendly_name -%} diff --git a/templates/goodnight.yaml b/templates/goodnight.yaml index d1853aa..2b68515 100644 --- a/templates/goodnight.yaml +++ b/templates/goodnight.yaml @@ -28,7 +28,7 @@ "switch.kids_bedroom", "switch.kitchen", "switch.office_room", - "switch.wemobackyardlightswitch"] %} + "switch.backyard_light"] %} {%- for item in lights_switches -%} {%- if states[item.split('.')[0]][item.split('.')[1]].state == "on" -%} {%- set friendly_name = states[item.split('.')[0]][item.split('.')[1]].attributes.friendly_name %}