From 7257282c884c4a69cab6b9d4bbe5dc4898332f21 Mon Sep 17 00:00:00 2001 From: Giorgio Ravera Date: Sun, 10 Feb 2019 19:54:25 +0100 Subject: [PATCH] Added TV commands --- automation/home_assistant.yaml | 2 - automation/media_player.yaml | 18 ++++++ configuration.yaml | 10 +-- customizations/group.yaml | 11 ++-- customizations/media_player.yaml | 25 ++++++++ google.yaml | 6 +- group/media_player.yaml | 18 ++++++ group/settings.yaml | 1 + input_boolean/home_assistant.yaml | 2 - input_text/media_player.yaml | 10 +++ logger.yaml | 3 +- script/media_player.yaml | 103 +++++++++++++++++++++++++++++- 12 files changed, 190 insertions(+), 19 deletions(-) create mode 100644 automation/media_player.yaml create mode 100644 group/media_player.yaml create mode 100644 input_text/media_player.yaml diff --git a/automation/home_assistant.yaml b/automation/home_assistant.yaml index e483a78c..ab374c65 100644 --- a/automation/home_assistant.yaml +++ b/automation/home_assistant.yaml @@ -121,8 +121,6 @@ ###################################################################### - alias: "Home Assistant: startup automations" - initial_state: off - trigger: - platform: homeassistant event: start diff --git a/automation/media_player.yaml b/automation/media_player.yaml new file mode 100644 index 00000000..ce0538fb --- /dev/null +++ b/automation/media_player.yaml @@ -0,0 +1,18 @@ +###################################################################### +# TV: change channel +# - greeting +# - disable away mode +###################################################################### + +- alias: TV cambia canale + trigger: + - platform: state + entity_id: input_text.tv_change_channel + + condition: [] + + action: + - service: script.tv_change_channel + data_template: + tv: "media_player.tv_sala" + channel: "{{ trigger.to_state.state }}" diff --git a/configuration.yaml b/configuration.yaml index fca211bf..fb565ef7 100644 --- a/configuration.yaml +++ b/configuration.yaml @@ -109,9 +109,6 @@ cover: !include_dir_merge_list cover/ # Switches switch: !include_dir_merge_list switch/ -# Input Boolean -input_boolean: !include_dir_merge_named input_boolean/ - # Text to speech tts: - platform: google @@ -131,7 +128,7 @@ mqtt: # EQ3 Max Cube maxcube: gateways: - - host: 192.168.0.28 + - host: maxcube.giorgioravera.it port: 62910 climate: platform: maxcube @@ -139,6 +136,11 @@ climate: # Google Assistant google_assistant: !include google.yaml +# Inputs +input_boolean: !include_dir_merge_named input_boolean/ +input_text: !include_dir_merge_named input_text/ +#input_number: !include_dir_merge_list input_number/ + # Zones zone: !include_dir_list zone/ diff --git a/customizations/group.yaml b/customizations/group.yaml index f115c96d..0f18cbb8 100644 --- a/customizations/group.yaml +++ b/customizations/group.yaml @@ -21,18 +21,21 @@ group.covers: group.climate: order: 11 -group.people: +group.media_player: order: 12 -group.network: +group.people: order: 13 -group.weather: +group.network: order: 14 -group.settings: +group.weather: order: 15 +group.settings: + order: 16 + group.all_automations: hidden: false control: hidden diff --git a/customizations/media_player.yaml b/customizations/media_player.yaml index 0af6d8f0..e527cf61 100644 --- a/customizations/media_player.yaml +++ b/customizations/media_player.yaml @@ -15,3 +15,28 @@ media_player.roku_yd00df095157: friendly_name: NowTV Anna media_player.roku_yd00dm481414: friendly_name: NowTV Giorgio + +# Script di comando +input_text.tv_change_channel: + friendly_name: Imposta Canale + icon: mdi:remote + +script.tv_volume_up: + friendly_name: Alza Volume + icon: mdi:volume-high + +script.tv_volume_down: + friendly_name: Abbassa Volume + icon: mdi:volume-medium + +script.tv_volume_mute: + friendly_name: Volume Muto + icon: mdi:volume-mute + +script.tv_play_pause: + friendly_name: Play/Pause + icon: mdi:play-pause + +script.tv_toggle: + friendly_name: Accendi/Spegni + icon: mdi:power diff --git a/google.yaml b/google.yaml index 02f74d62..25829dc2 100644 --- a/google.yaml +++ b/google.yaml @@ -55,11 +55,7 @@ entity_config: name: Blue-Ray Camera room: Camera expose: true - media_player.roku_yd00dm481414: - name: NowTV Giorgio - room: Sala - expose: true - media_player.ue46c7000_samsung_dtv_rcr: + media_player.tv_sala: name: TV Sala room: Sala expose: true diff --git a/group/media_player.yaml b/group/media_player.yaml new file mode 100644 index 00000000..98f512da --- /dev/null +++ b/group/media_player.yaml @@ -0,0 +1,18 @@ +media_player: + name: Dispositivi Multimediali + view: true + icon: mdi:television + entities: + - group.tv_sala + +tv_sala: + name: TV Sala + control: hidden + entities: + - media_player.tv_sala + - script.tv_volume_up + - script.tv_volume_down + - script.tv_volume_mute + - script.tv_play_pause + - script.tv_toggle + - input_text.tv_change_channel diff --git a/group/settings.yaml b/group/settings.yaml index 235df263..ba51833b 100644 --- a/group/settings.yaml +++ b/group/settings.yaml @@ -3,6 +3,7 @@ settings: view: true icon: mdi:settings entities: + - binary_sensor.home_mode - group.all_automations - group.ha_settings diff --git a/input_boolean/home_assistant.yaml b/input_boolean/home_assistant.yaml index bfeb7f98..ef304435 100644 --- a/input_boolean/home_assistant.yaml +++ b/input_boolean/home_assistant.yaml @@ -5,7 +5,6 @@ home_mode_day: name: Giorno icon: mdi:white-balance-sunny - initial: on home_mode_night: name: Notte @@ -15,7 +14,6 @@ home_mode_night: home_mode_away: name: Vacanza icon: mdi:airplane-takeoff - initial: off ###################################################################### # Inputs: Notification Settings diff --git a/input_text/media_player.yaml b/input_text/media_player.yaml new file mode 100644 index 00000000..1afe0ae5 --- /dev/null +++ b/input_text/media_player.yaml @@ -0,0 +1,10 @@ +###################################################################### +# Input Text: TV Change Channel +###################################################################### + +tv_change_channel: + name: Cambia Canale + min: 1 + max: 3 + pattern: '[1-999]' + mode: text \ No newline at end of file diff --git a/logger.yaml b/logger.yaml index bfaa53bb..b9ce1bb9 100644 --- a/logger.yaml +++ b/logger.yaml @@ -6,4 +6,5 @@ default: info logs: homeassistant.components.automation: info - homeassistant.components.device_tracker: warn \ No newline at end of file + homeassistant.components.device_tracker: warn + homeassistant.components.input_text: info diff --git a/script/media_player.yaml b/script/media_player.yaml index ed2ea8f6..27765f85 100644 --- a/script/media_player.yaml +++ b/script/media_player.yaml @@ -9,7 +9,7 @@ ###################################################################### tv_change_channel: - alias: TV Cambia Canale + alias: TV Cambia canale sequence: - service: media_player.play_media data_template: @@ -21,3 +21,104 @@ tv_change_channel: media_content_type: "channel" media_content_id: >- {{ channel }} + +###################################################################### +# Script: TV Volume Up +# Inputs: +# - tv +# +# Operations: +# - media_player.volume_up +###################################################################### + +tv_volume_up: + alias: TV Alza volume + sequence: + - service: media_player.volume_up + data_template: + entity_id: >- + {% if tv | length == 0 %} + {% set tv = 'media_player.tv_sala' %} + {% endif %} + {{ tv }} + +###################################################################### +# Script: TV Volume Down +# Inputs: +# - tv +# +# Operations: +# - media_player.volume_down +###################################################################### + +tv_volume_down: + alias: TV Abbassa volume + sequence: + - service: media_player.volume_down + data_template: + entity_id: >- + {% if tv | length == 0 %} + {% set tv = 'media_player.tv_sala' %} + {% endif %} + {{ tv }} + +###################################################################### +# Script: TV Volume Mute +# Inputs: +# - tv +# +# Operations: +# - media_player.volume_mute +###################################################################### + +tv_volume_mute: + alias: TV Volume Muto + sequence: + - service: media_player.volume_mute + data_template: + entity_id: >- + {% if tv | length == 0 %} + {% set tv = 'media_player.tv_sala' %} + {% endif %} + {{ tv }} + is_volume_muted: true + +###################################################################### +# Script: TV Play/Pause +# Inputs: +# - tv +# +# Operations: +# - media_player.media_play_pause +###################################################################### + +tv_play_pause: + alias: TV Play/Pause + sequence: + - service: media_player.media_play_pause + data_template: + entity_id: >- + {% if tv | length == 0 %} + {% set tv = 'media_player.tv_sala' %} + {% endif %} + {{ tv }} + +###################################################################### +# Script: TV Toggle +# Inputs: +# - tv +# +# Operations: +# - media_player.toggle +###################################################################### + +tv_toggle: + alias: TV Accendi/Spegni + sequence: + - service: media_player.toggle + data_template: + entity_id: >- + {% if tv | length == 0 %} + {% set tv = 'media_player.tv_sala' %} + {% endif %} + {{ tv }} -- 2.47.3