Hello just started with HA. Totally new with scripting. Really like it, but read it really depends on spaces etc. i found the following script on youtube:
(Don’t know how to show my whitespaces) When i check the configuration i get the following error:
2022-02-14 23:33:46 ERROR (MainThread) [homeassistant.config] Invalid config for [script]: template value should be a string for dictionary value @ data[‘sequence’][1][‘data’]. Got None. (See /config/configuration.yaml, line 9).
I have looked for typos etc for hours. Found a lot, but now i can’t see what’s wrong anymore. A little help would be appreciated
To get the text to behave use the </> icon in menu of the response box and paste your text between the resulting ‘’’ and ‘’’ . You will see the correctly formatted text to the right of the response box. Are you sure all the places you put template strings accept them (not all inputs are template-able)
So the error indicates it’s in sequence[1] which is the second service (0 relative). Try putting quotes around the urls in the media_content_id since it’s complaining about looking for a string and maybe the ://, etc. is giving it problems. It doesn’t look to me like there is any spacing issues.
if animal is cat then cat else if animal is dog then dog
Why not just use the value of animal directly? Or, in your case, does the input_select offer more than two choices of media_players and you’re only interested in two specific choices?
Assuming there are only two choices of media_player, try this: