#How to handle if attribute is a number?

1 messages · Page 1 of 1 (latest)

calm iris
#

I can't figure this out, I have an entity sensor.charger_status_connector
It looks like the attatched picture in the dev tools, but when i try to use this state in an automation i get this error message when trying it out:

message: attribute '1' of entity sensor.charger_status_connector does not exist

How can this be when the dev tools agree with me :)
The only thing i can think of is if one of them handles the "attribute" value as a number and not as text!

#

The automation action looks like this :

sly snow
#

Complain at the person who maintains that integration

#

Otherwise you could break it out in a template condition more reliably

calm iris
#

Im not much for complaining so i guess I'm gonna start trying to figure out templates then!

sly snow
#

Complaining in this case is helpful, raise an issue and they should be able to fix it easily

calm iris
#

So the attribute should be called something other than "1"?

#

I'm wondering in this case if this would be the manufacturer of my EV charge box :)

#

oh well i'll raise an issue at github first

#

see where it takes me

#

Thanks for the help!

novel needle
#

Can you just remove the quotes around the 1 in your YAML?

calm iris
#

tried that it gives "Message malformed: expected str for dictionary value @ data['actions'][0]['if'][0]['attribute']"

sly snow
novel needle
#

Ah. You could try a template condition then.
{{ is_state_attr('sensor.charger_status_connector', 1, 'Available') }}

#

But I agree that attribute name should be changed