Quantcast
Channel: Configuration - Home Assistant Community
Viewing all articles
Browse latest Browse all 95919

Tv sleep timer

$
0
0

@lGregl wrote:

Hi I’m trying to do a very simple input select sleep timer for the tv

In configuration

input_select:
  tv_sleep_timer:
    name: tv_sleep_timer
    options:
    - 30 minutes
    - 1 hour
    - 2 hours
    initial: 1 hour

timer:
  samsung_tv30:
    duration: '00:30:00'
  samsung_tv1:
    duration: '01:00:00'
  samsung_tv2:
    duration: '02:00:00'


scripts

'tv_sleep_timer':
  alias: Tv sleep timer
  sequence:
  - service: timer.start
    data_template:
      entity_id: >
         {% if is_state("input_select.tv_sleep_timer", "30 minutes") %} timer.samsung_tv30
         {% elif is_state("input_select.tv_sleep_timer", "1 hour") %} timer.samsung_tv1
         {% elif is_state("input_select.tv_sleep_timer", "2 hours") %} timer.samsung_tv2
         {% endif %}


and automation

- id: 'tv sleep off'
  alias: Tv sleep off
  trigger:
    - platform: event
      event_type: timer.finished
      event_data:
        entity_id: timer.samsung_tv30
    - platform: event
      event_type: timer.finished
      event_data:
        entity_id: timer.samsung_tv1
    - platform: event
      event_type: timer.finished
      event_data:
        entity_id: timer.samsung_tv2
  action:
    service: media_player.turn_off
    entity_id: media_player.samsung_tv_remote

I’ve entered the entity into lovelace

but the timers wont trigger?

I can’t see where the error is and I’m sure it must be very obvious?

Thanks

Posts: 2

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 95919

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>