I am trying to automate my Harmony remote, but I am not able to get it to work.
My idea is to turn off all the lights when I switch of an activity such as Watch TV. I can’t find the entity of the remote, so not sure what to put in there.
So the automation should start when I stop watching TV by clicking the off button on the remote. Which will end the activity Watch TV
Then it should turn of several lamps as well as dimming other lamps (stair case, bedroom and bathroom).
I am trying to write this in yaml not python or anything like that. If someone could share their configuration or how I should proceed with this, that would be much appreciated.
You would need to write an automation with as trigger the state of your harmony remote. For example, I called mine “family_room” thus the trigger in the automation would be:
trigger:
- platform: state
entity_id: remote.family_room
That would trigger the automation for each state change. Next you can then add a condition to your automation:
That will ensure the automation only runs if the current activity is PowerOff.
And then you can do action to call the respective services. Thus it would look like:
- alias: "Turn on lights when powering off TV".
trigger:
- platform: state
entity_id: remote.family_room
condition:
condition: template
value_template: "{{ state_attr('remote.family_room','current_activity') == 'PowerOff' }}"
action:
service: turn_lights_on
OR, you can create the trigger as a template instead and then have it like:
- alias: "Turn on lights when powering off TV".
trigger:
- platform: template
value_template: "{{ state_attr('remote.family_room','current_activity') == 'PowerOff' }}"
action:
service: turn_lights_on
Do yourself a favour and install emulated_roku, then you can write a script/scene to do what you want and add it to your Activity on your Harmony rather than making HA trigger it.
Yes. It is to 19:00:00.
The log says nothing? If I click the trigger button in hass.io nothing happening either. This should turn of the activity right?
Here it is:
2018-09-26 20:01:17 ERROR (SyncWorker_3) [homeassistant.components.remote.harmony] No activity specified with turn_on service
The thing is, I can turn off the activity hence the TV by clicking the harmony off button inn Hass.io. If I run the automation “Turn off light after watching TV” it does only swith off the lamp but nothing else.
I want the lamp to be switch off when I turn off the remote\ending Watch TV from remote.
The automation is this:
- alias: Turn off light after watching TV
trigger:
- platform: state
entity_id: remote.harmony_hub
condition: # this list of conditions is 'and'ed together.
- condition: template
value_template: >
{{ trigger.from_state.attributes.current_activity == 'Watch TV' and
trigger.to_state.attributes.current_activity == 'PowerOff' }}
- condition: time
after: '21:00:00' # 9 pm
action:
- service: switch.turn_off
entity_id: switch.fibaro_system_blomster_lampe`
I think you have a miss interpretation of what the auotmation is doing. An automation is an automated process that runs in the background. It’s not something that you will be ‘pressing’. You pressing it only executes the actions, it does not test the condition or the trigger.
What should be happening is:
You turn off the activity via the remote. The automation is triggered and turns off the light if the conditions are met.
So, when logger default is set to ‘info’, it should spit out all events and services to your log. You need to check and see if home assistant see’s your events. One of the 2 conditions is not being met most likely if you are not getting errors.
That could mean 1 of 6 things:
Your “Watch TV” activity has in the template has an incorrect name.
Your “PowerOff” activity has in the template has an incorrect name.
The time is before 9pm.
The time on your operating system is set incorrectly.
The timezone in your configuration.yaml is set incorrectly.
The attribute inside the state object (from_state, to_state) is incorrectly named. (This is unlikely, because I verified that on my system.
When it comes to naming your activities and writing templates, the names have to have identical case, spelling, and whitespace. For example "Watch TV" does not equal "Watch Tv".