Closed
Description
Hi,
using state.set("domain.entity", "new state")
removes existing attributes. It is possible to supply an attribute dict, but there was no way of collecting all existing attributes from a state. state.get()
only supported pulling a single attribute by name.
Also state_get()
would not return the full State object, but only the state as string or the attribute value.
As a possible way to fix this, I did some changes:
- Add
states
object, known from template extensions to be the new way of simple state retrievals - Add new method
get_new
that returns the actual State object and remappedstate.get()
to it - Add new method
set_new
that preserves existing attributes by default, but also allowes them to be updated or removed
The PR will follow soon.
Metadata
Metadata
Assignees
Labels
No labels