Then I get this error every time once I select an option. [ Invalid service data for input_boolean.turn_on: Entity ID is an invalid entity id for dictionary value @ data[âentity_idâ]. Got â â ]
Are these two lines on two rows in your code too? Iâm thinking that yaml is very picky on indentations, maybe you should try to put all of this one one single line.
In your data_template, you have no âelseâ section. So if the state of input_select.harmonyscene is neither Music, Apple TV, TV Box nor PS4 the data_template returns an empty entity_id.
You should check the state by adding a log statement or prevent the action by adding an appropriate condition.
@bonterra Tried but no luck. @m0wlheld I donât think itâs an âelseâ issue, no matter which option I select, same error popup. And also I tried to add else part, but stillâŚ
First off, Iâd get rid of the from: âSelectâ in your trigger. Because if youâre switching from one activity to another, it wonât trigger. Second, you should use >- to take away spaces and line breaks. But also putting each if on the same line will probably solve your problem. Try this:
Ok I see whatâs happening here. You are resetting the input_select back to âSelectâ, then trying to read the input_select. You need to reverse the order. Make it the last thing you do, like thisâŚ
This is an interesting work around to deal with the harmony auto shutting off the other activities when a different one is activated.
Just curious, what happens when you switch to Music, then switch to Apple TV, then switch back to Music? From looking at your code, it doesnât handle this and you may into issues. I would expect your input_booleans over time to all be turned on. You may want to swap those booleans to template switches. The beauty of switch templates is that the state of the switch is independent from the user interactions. Basically, Your hardware can turn off the switch without triggering the âturn_offâ home assistant.
Then you donât need any automation and you can just click the buttons in the interface instead of using a dropdown list.
So how this works is the state of the switch is changed by the value_template. When that changes, it does not trigger the on/off in home assistant. So you donât need to build an automation to turn_on/off like you do with input booleans. Super helpful.
@sephrioth Actually, I forgot to mention that earlier, @petro is correct, instead of input_booleans, use template switches. Otherwise, youâd need to add another service to turn off all other input_booleans which activities arenât running. Much simplier using switches though.
@petro@Jer78
I tried Template Switch in the very beginning, but the issue is the switch CAN NOT keep the states, once I turn on a template switch, it will jump to off in seconds automatically. Then I did some google work and found someone said I should use a boolean to save the current stateâŚ
BTW, I have soma additional code to switch between activitiesâŚ
But what will happen if I directly switch to another activity? The current switch is still on? But the harmony only has one running activity, you switch to another and the previous one goes off.