Hi.
Is there an api reference for the hass.states.set python procedure.
I am trying to set a sensor using a python script but keep getting syntax errors. I am sure it’s something simple but seeing some documentation on it would be a great help.
I have a template sensor to hold a power total in kWh and am trying to set it with the following:
attribute() is not a valid jinja method. here is the documents for templating. Friendly reminder: You can’t make up methods and expect them to work.
value_template sets the state. If you’re trying to set the state, set the state. Not an attribute of the state object.
What’s the point of even having the sensor template? It does nothing other than complicate your setup. Just use the python script and set the entity_id. hass.states.set will create any entity.
I’m also looking for this. The “See available methods” links on the following page are broken:
They just lead to the “Home Assistant Developer Docs” home page. And searching from that page for “hass.states.set” only yields tutorial links - not documentation of the method.