Hi there is it possible to run a automation for harmony hub activity to be triggered at a set time say the news starts at 6pm and I have activity that turns tv on and selects Chanel 7 how could I make this trigger I can’t get anything to work thanks .
Should be simple enough, post where you’ve got to and we can amend it where necessary for you.
Hi thatnks for your reply I have know idea how to make this work lol maybe somthing like this below.
- alias: 'Turn Tv on for News'
trigger:
platform: time
at: '05:55:00'
action:
- service: remote.turn_on
entity_id: input_select.harmony
data_template:
activity: "29271221" # Watch TV
- alias: Harmony
hide_entity: True
trigger:
platform: state
entity_id: input_select.harmony
from: 'Select Input'
action:
- service: remote.turn_on
entity_id: remote.living_room
data_template:
activity: >
{% if is_state("input_select.harmony", "Watch TV") %}
29271221
{% elif is_state("input_select.harmony", "KODI") %}
13989850
{% elif is_state("input_select.harmony", "AIRCON") %}
13967100
{% elif is_state("input_select.harmony", "XboX One X Controlls") %}
29271460
{% elif is_state("input_select.harmony", "PowerOff") %}
-1 -
{% else %}
{% endif %}
- service: input_select.select_option
entity_id: input_select.harmony
data_template:
option: "Select Input"
- alias: Harmony Off
hide_entity: True
trigger:
platform: state
entity_id: input_select.harmony
to: 'Power Off'
action:
- service: remote.turn_off
entity_id: remote.living_room
- service: input_select.select_option
entity_id: input_select.harmony
data_template:
option: "Select Input"
Okey dokey, assuming your remote name and activity codes are correct, something like this…
- id: turn_tv_on_for_news
alias: Turn Tv on for News
hide_entity: false
trigger:
platform: time
at: '05:55:00'
action:
- service: remote.turn_on
data:
entity_id: remote.living_room
activity: 29271221 # Watch TV
- delay: '00:00:05'
- service: remote.send_command
data:
entity_id: remote.living_room
command:
- 7
Which translates to…
At 5:55am, turn ‘Watch TV’ activity on.
Wait 5 seconds for TV to finish its start up.
Send button ‘7’ to change channel to number 7
Obviously, you can then tweak this to suit.
thank you so much fortunately my activity already changes to channel 7 so ive just removed the lower 5 lines of code: as per bellow.
- id: turn_tv_on_for_news
alias: Turn Tv on for News
hide_entity: false
trigger:
platform: time
at: '05:55:00'
action:
- service: remote.turn_on
data:
entity_id: remote.living_room
activity: 29271221 # Watch TV
I am thinking of adding conditions like only run automation if binary sensor has been triggered in the last 30mins
ill add code below could of what im trying and hopefully its workable .
- id: turn_tv_on_for_news
alias: Turn Tv on for News
hide_entity: false
trigger:
platform: time
at: '05:55:00'
condition:
condition: state
entity_id: binary_sensor.living_room_pir
timer:
duration: '00:30:00 # Only run Action If binary_sensor triggerd in last 30 mins
action:
- service: remote.turn_on
data:
entity_id: remote.living_room
activity: 29271221 # Watch TV
# - delay: '00:00:05'
# - service: remote.send_command
# data:
# entity_id: remote.living_room
# command:
# - 7
OK this is the updated attempt not sure if i am on the correct path to making this work any ideas or suggestions would much appreciate thanks. for some reason my timer never starts just sits in the idle state even if i manuly trigger the binary_sensor
**configuration.yaml**
timer:
newson:
duration: '00:30:00'
**automation.yaml**
- id: turn_tv_on_for_news
alias: Turn Tv on for News
hide_entity: false
trigger:
platform: time
at: '05:55:00'
condition:
condition: state
entity_id: timer.newson
state: 'on' # maybe should be start not on
action:
- service: remote.turn_on
data:
entity_id: remote.living_room
activity: 29271221 # Watch TV
# - delay: '00:00:05'
# - service: remote.send_command
# data:
# entity_id: remote.living_room
# command:
# - 7
- id: timernewson
alias: timer tv news
trigger:
platform: state
entity_id: binary_sensor.living_room_pir
to: 'on'
action:
service: timer.start
data:
entity_id: timer.newson
Turns out alot of my issues are being cause by all my automatons stopping working even after rebooting system.
I am having to manually restart the automation’s service via Hass UI only thing i can see in logs is lots of Timer got out of sync errors as per below .
2017-12-29 03:31:52 WARNING (Recorder) [homeassistant.components.recorder] Ended unfinished session (id=9 from 2017-12-29 03:23:09.933090)
2017-12-29 03:32:08 WARNING (MainThread) [homeassistant.setup] Setup of input_select is taking over 10 seconds.
2017-12-29 03:32:08 WARNING (MainThread) [homeassistant.setup] Setup of sensor is taking over 10 seconds.
2017-12-29 03:32:08 WARNING (MainThread) [homeassistant.setup] Setup of binary_sensor is taking over 10 seconds.
2017-12-29 03:32:08 WARNING (MainThread) [homeassistant.setup] Setup of input_boolean is taking over 10 seconds.
2017-12-29 03:32:08 WARNING (MainThread) [homeassistant.setup] Setup of alarm_control_panel is taking over 10 seconds.
2017-12-29 03:32:08 WARNING (MainThread) [homeassistant.setup] Setup of timer is taking over 10 seconds.
2017-12-29 03:32:19 WARNING (MainThread) [homeassistant.setup] Setup of remote is taking over 10 seconds.
2017-12-29 03:32:54 WARNING (MainThread) [homeassistant.components.media_player] Setup of platform cast is taking over 10 seconds.
2017-12-29 03:33:27 ERROR (MainThread) [homeassistant.core] Timer got out of sync. Resetting
2017-12-29 03:33:35 ERROR (MainThread) [homeassistant.core] Timer got out of sync. Resetting
2017-12-29 04:13:40 ERROR (MainThread) [homeassistant.core] Timer got out of sync. Resetting
2017-12-29 05:02:43 ERROR (MainThread) [homeassistant.core] Timer got out of sync. Resetting
2017-12-29 05:08:50 ERROR (MainThread) [homeassistant.core] Timer got out of sync. Resetting
2017-12-29 05:09:10 ERROR (MainThread) [homeassistant.core] Timer got out of sync. Resetting