TIP:
Your automation is defined using YAML which Home Assistant understands as JSON. The condition
section of your automation looks like this in JSON:
"condition": [
{
"condition": "numeric state",
"entity_id": "sensor.illumination_286c07fa2477",
"above": 300,
"below": 1000
}
],
That’s represents a fragment of a JSON dictionary (a data structure that organizes information using key:value pairs).
Here’s that error message you received:
not a valid value for dictionary value @ data[‘condition’][0][‘condition’]
OK, it says one of the dictionary values is invalid and says it’s this one:
data['condition'][0]['condition']
The complaint is regarding condition
, specifically its zeroth item (it’s zero-based so the first item is actually the zeroth), containing the key condition
.
Referring to the JSON code (shown above), we see it’s complaining about "condition": "numeric state",
.
Here’s a different example. Let’s say this was your condition
section, containing two conditions:
condition:
- condition: state
entity_id: input_boolean.test
state: 'on'
- condition: numeric state
entity_id: sensor.illumination_286c07fa2477
above: 300
below: 1000
In this case the error is in the second condition. Home Assistant’s error message would be:
`not a valid value for dictionary value @ data['condition'][1]['condition']`
Notice the [1]
instead of [0]
? That’s because the error is no longer in the zeroth item but in the first item. Again, we have to remember is is zero-based so 1
actually means the second item.
I hope this helps to de-mystify the error messages, even if only just a little bit.