They work great normally. However at startup HA doesn’t have all the attributes yet (i.e. ‘current_power_w’ is not in the states tab) and they throw an error. Or if there isn’t a KWh reading yet it will show as unknown.
I would like for them to not throw an error when the attribute isn’t available and read 0 until another value is provided. Is this possible?
Which should return the value if present and none if it isn’t? Then you could use the same method as above to make it zero if needed, but it’s a shed load less code.
All of this is a random thought btw, might not even work.
I think I used that and it throws an error as ‘current_power_w’ isn’t defined sometimes. Its not a issue of an unknown value, the attribute actually doesn’t exist until you turn the switch on. That works fine for reading the value when the attribute is present.