From 247530e3a2afe41e8d349c47564c491a60f2b8d1 Mon Sep 17 00:00:00 2001 From: KemoNine Date: Sun, 5 May 2019 02:21:08 +0000 Subject: [PATCH] Overhaul main dashboard, integrate cameras, update media player configs, add play/pause button for chromecasts --- appdaemon/.gitignore | 1 + appdaemon/dashboards/Cameras.dash | 34 +++++++++++ appdaemon/dashboards/Entertainment.dash | 22 ++++++++ appdaemon/dashboards/Main.dash | 31 +++++++--- appdaemon/dashboards/entertainment.yaml | 43 ++++++++++++++ appdaemon/secrets-example.yaml | 1 + configuration.yaml | 4 ++ media/cast.yaml | 4 +- switches/cast.yaml | 75 +++++++++++++++++++++++++ 9 files changed, 206 insertions(+), 9 deletions(-) create mode 100644 appdaemon/dashboards/Cameras.dash create mode 100644 appdaemon/dashboards/Entertainment.dash create mode 100644 appdaemon/dashboards/entertainment.yaml create mode 100644 switches/cast.yaml diff --git a/appdaemon/.gitignore b/appdaemon/.gitignore index e3ca647..fcc4735 100644 --- a/appdaemon/.gitignore +++ b/appdaemon/.gitignore @@ -1 +1,2 @@ compiled +cameras.yaml \ No newline at end of file diff --git a/appdaemon/dashboards/Cameras.dash b/appdaemon/dashboards/Cameras.dash new file mode 100644 index 0000000..2e1b1ef --- /dev/null +++ b/appdaemon/dashboards/Cameras.dash @@ -0,0 +1,34 @@ +# Dashboard Config +title: Cameras +widget_dimensions: [120, 120] +widget_size: [1, 1] +widget_margins: [5, 5] +columns: 8 +rows: 19 +global_parameters: + use_hass_icon: 1 + +nav_back: + widget_type: navigate + dashboard: Main + icon_inactive: mdi-arrow-left-bold-outline + widget_style: "background: MEDIUMSLATEBLUE;" + +# Layout +layout: + - include: header + - include: cameras + - nav_main, clock(5x1), nav_back, reload + - camera_stairs(8x6) + - + - + - + - + - + - camera_deck(8x6) + - + - + - + - + - + - camera_living_room(8x6) diff --git a/appdaemon/dashboards/Entertainment.dash b/appdaemon/dashboards/Entertainment.dash new file mode 100644 index 0000000..5b2d9de --- /dev/null +++ b/appdaemon/dashboards/Entertainment.dash @@ -0,0 +1,22 @@ +# Dashboard Config +title: Entertainment +widget_dimensions: [120, 120] +widget_size: [1, 1] +widget_margins: [5, 5] +columns: 4 +rows: 3 +global_parameters: + use_hass_icon: 1 + +nav_back: + widget_type: navigate + dashboard: Main + icon_inactive: mdi-arrow-left-bold-outline + widget_style: "background: MEDIUMSLATEBLUE;" + +# Layout +layout: + - include: header + - nav_main, clock, nav_back, reload + - include: entertainment + - bedroom_tv(2x2), living_room_tv(2x2) diff --git a/appdaemon/dashboards/Main.dash b/appdaemon/dashboards/Main.dash index dd6ba51..b68c98d 100644 --- a/appdaemon/dashboards/Main.dash +++ b/appdaemon/dashboards/Main.dash @@ -3,8 +3,8 @@ title: Home widget_dimensions: [120, 120] widget_size: [1, 1] widget_margins: [5, 5] -columns: 4 -rows: 4 +columns: 6 +rows: 8 global_parameters: use_comma: 0 precision: 0 @@ -14,7 +14,13 @@ global_parameters: nav_weather: widget_type: navigate dashboard: Weather - icon_inactive: mdi-arrow-right-bold-outline + icon_inactive: mdi-weather-sunny + widget_style: "background: MEDIUMSLATEBLUE;" + +nav_entertainment: + widget_type: navigate + dashboard: Entertainment + icon_inactive: mdi-television-classic widget_style: "background: MEDIUMSLATEBLUE;" nav_desk: @@ -29,6 +35,12 @@ nav_status: icon_inactive: mdi-router-wireless-settings widget_style: "background: MEDIUMSLATEBLUE;" +nav_cameras: + widget_type: navigate + dashboard: Cameras + icon_inactive: mdi-cctv + widget_style: "background: MEDIUMSLATEBLUE;" + # Widgets current_weather: widget_type: weather @@ -51,10 +63,15 @@ current_weather: wind_speed: "" pressure: "" - # Layout layout: - include: header - - nav_main, clock(2x1), reload - - current_weather(3x1), nav_weather - - nav_desk, spacer(2x1), nav_status + - include: cameras + - include: entertainment + - nav_main, clock(4x1), reload + - nav_weather, current_weather(2x1), nav_entertainment, nav_desk, nav_status + - bedroom_tv(3x2), living_room_tv(3x2) + - + - camera_stairs(3x2), camera_living_room(3x2) + - + - nav_cameras, spacer(5x1) diff --git a/appdaemon/dashboards/entertainment.yaml b/appdaemon/dashboards/entertainment.yaml new file mode 100644 index 0000000..399fb05 --- /dev/null +++ b/appdaemon/dashboards/entertainment.yaml @@ -0,0 +1,43 @@ +play_pause_living_room_tv: + widget_type: switch + title: Living Room + entity: switch.living_room_tv + icon_on: mdi-pause + icon_off: mdi-play + +mute_living_room_tv: + widget_type: switch + title: Living Room + entity: switch.living_room_tv_mute + icon_on: mdi-volume-off + icon_off: mdi-volume-high + +play_pause_bedroom_tv: + widget_type: switch + title: Bedroom + entity: switch.bedroom_tv + icon_on: mdi-pause + icon_off: mdi-play + +mute_bedroom_tv: + widget_type: switch + title: Living Room + entity: switch.bedroom_tv_mute + icon_on: mdi-volume-off + icon_off: mdi-volume-high + +bedroom_tv: + widget_type: media_player + entity: media_player.bedroom_tv + title: Bedroom TV + step: 5 + icon_on: mdi-power-settings + icon_off: mdi-power + +living_room_tv: + widget_type: media_player + entity: media_player.living_room_tv + title: Living Room TV + step: 5 + icon_on: mdi-power-settings + icon_off: mdi-power diff --git a/appdaemon/secrets-example.yaml b/appdaemon/secrets-example.yaml index 9af78ce..e4664af 100644 --- a/appdaemon/secrets-example.yaml +++ b/appdaemon/secrets-example.yaml @@ -1,5 +1,6 @@ # General Config ha_token: "A very big string here" +ha_api_secret: "the http_password from the main ha secrets.yaml file (needed for cameras)" appdaemon_elevation: 0 appdaemon_latitude: 0 appdaemon_longitude: 0 diff --git a/configuration.yaml b/configuration.yaml index a158fb8..caae903 100644 --- a/configuration.yaml +++ b/configuration.yaml @@ -188,6 +188,10 @@ camera: !include_dir_merge_list cameras/ # Sensors sensor: !include_dir_merge_list sensors/ + +# Switches +switch: !include_dir_merge_list switches/ + # Track the sun sun: diff --git a/media/cast.yaml b/media/cast.yaml index 8e63ae3..c643a1d 100644 --- a/media/cast.yaml +++ b/media/cast.yaml @@ -1,2 +1,2 @@ - media_player: - !secret google_casts \ No newline at end of file +media_player: + !secret google_casts diff --git a/switches/cast.yaml b/switches/cast.yaml new file mode 100644 index 0000000..4bc0582 --- /dev/null +++ b/switches/cast.yaml @@ -0,0 +1,75 @@ +- platform: template + switches: + living_room_tv: + value_template: "{{ is_state('media_player.living_room_tv', 'playing') }}" + turn_on: + service: media_player.media_play + data: + entity_id: media_player.living_room_tv + turn_off: + service: media_player.media_pause + data: + entity_id: media_player.living_room_tv + icon_template: >- + {% if is_state('media_player.living_room_tv', 'playing') %} + mdi:pause + {% else %} + mdi:play + {% endif %} + +#- platform: template +# switches: +# living_room_tv_mute: +# value_template: "{{ state_attr('media_player.living_room_tv', 'is_volume_muted') != 'false' }}" +# turn_on: +# service: media_player.volume_mute +# data: +# entity_id: media_player.living_room_tv +# turn_off: +# service: media_player.volume_mute +# data: +# entity_id: media_player.living_room_tv +# icon_template: >- +# {% if state_attr('media_player.living_room_tv', 'is_volume_muted') != 'false' %} +# mdi:volume-high +# {% else %} +# mdi:volume-off +# {% endif %} + +- platform: template + switches: + bedroom_tv: + value_template: "{{ is_state('media_player.bedroom_tv', 'playing') }}" + turn_on: + service: media_player.media_play + data: + entity_id: media_player.bedroom_tv + turn_off: + service: media_player.media_pause + data: + entity_id: media_player.bedroom_tv + icon_template: >- + {% if is_state('media_player.bedroom_tv', 'playing') %} + mdi:pause + {% else %} + mdi:play + {% endif %} + +#- platform: template +# switches: +# bedroom_tv_mute: +# value_template: "{{ state_attr('media_player.bedroom_tv', 'is_volume_muted') != 'false' }}" +# turn_on: +# service: media_player.volume_mute +# data: +# entity_id: media_player.bedroom_tv +# turn_off: +# service: media_player.volume_mute +# data: +# entity_id: media_player.bedroom_tv +# icon_template: >- +# {% if state_attr('media_player.bedroom_tv', 'is_volume_muted') != 'false' %} +# mdi:volume-high +# {% else %} +# mdi:volume-off +# {% endif %}