I want the value of assd_state in the data template below to be either boolean True or False, not a string “True” or “False”. The state attribute itself is, of course, a boolean.
Am I on the right track? Is there a simple way to know whether a variable is a string or boolean?
Regarding my original question, I think that I may be looking in the wrong place for the source of the problem in my automation configuration.
I had originally tried an if statement to check the value of assumed stat, but I kept getting configuration validation errors. So, I decided to stop checking the value and just copy it into the variable as-is.
When I adapt your code, I am again getting config validation errors. There is a similar if statement in the same data_template which validates and executes correctly. Here is the relevant portion of the automation:
Invalid config for [automation]: invalid template (TemplateSyntaxError: expected token ',', got 'assumed_state') for dictionary value @ data['action'][0]['data_template']['assumed_state']. Got None. (See /config/configuration.yaml, line 13). Please check the docs at https://home-assistant.io/components/automation/
The similar brightness if statement passes the config check and executes as expected.
I’m sure that I must be overlooking something simple. Any ideas?
Thanks for the reply. I actually did have the > in the real config file. It was a cut and paste error getting it into the message. I checked again to be sure, and I’m still getting the error.
EDIT: Checked again as I was writing this and realized that I was missing a single quote in the in the assumed_state if statement.