From: Giorgio Ravera Date: Fri, 17 Jan 2020 10:05:40 +0000 (+0100) Subject: Modified TV sala X-Git-Url: http://git.giorgioravera.it/?a=commitdiff_plain;h=2b436f37729278bd48e8800976be1cfd25df2dee;p=homeassistant.git Modified TV sala --- diff --git a/script/media_player.yaml b/script/media_player.yaml index feefd630..67b60d34 100644 --- a/script/media_player.yaml +++ b/script/media_player.yaml @@ -1,19 +1,54 @@ ###################################################################### -# Script: TV Toggle +# Script: TV Sala Toggle # Inputs: # - tv # # Operations: -# - media_player.toggle +# - script.turn_on ###################################################################### -tv_toggle: - alias: "TV: Accendi/Spegni" +tv_sala_toggle: + alias: "TV Sala: Accendi/Spegni" sequence: - - service: media_player.toggle + - service: script.turn_on data_template: entity_id: >- - {% if tv | length == 0 %} - {% set tv = 'media_player.tv_sala' %} + {% if is_state('media_player.tv_sala', 'on') %} + script.tv_sala_off + {% else %} + script.tv_sala_on {% endif %} - {{ tv }} + +###################################################################### +# Script: TV Sala On +# Inputs: +# - tv +# +# Operations: +# - script.turn_on +###################################################################### + +tv_sala_on: + alias: "TV Sala: Accendi" + sequence: + #- service: shell_command.bravia_tvpower + - service: media_player.toggle + data_template: + entity_id: 'media_player.tv_sala' + +###################################################################### +# Script: TV Sala Off +# Inputs: +# - tv +# +# Operations: +# - script.turn_on +###################################################################### + +tv_sala_off: + alias: "TV Sala: Spegni" + sequence: + #- service: shell_command.bravia_poweroff + - service: media_player.toggle + data_template: + entity_id: 'media_player.tv_sala' diff --git a/ui-lovelace.yaml b/ui-lovelace.yaml index 69efb388..3115c490 100644 --- a/ui-lovelace.yaml +++ b/ui-lovelace.yaml @@ -307,7 +307,7 @@ views: action: call-service service: script.turn_on service_data: - entity_id: script.tv_toggle + entity_id: script.tv_sala_toggle # Top Buttons 2 - type: horizontal-stack cards: