lovelace-state-switch
lovelace-state-switch copied to clipboard
Feature request: a template result is available as a variable
Hi @thomasloven I would like to request an enhancement to the "default" option.
Currently
If the entity: template option is used, the result is computed and the state switch mechanism directs to the appropriate "state". The default: x option takes care of unknown/unrecognised states.
Issue
If the state is unknown/unrecognised, the default code doesn't know what the actual state value is/was. This prevents at least 2 scenarios useful to developers:
- Debugging - what state value was actually computed?
- Parameters - the actual state value could be passed on to a child card for processing i.e. routing decisions, display etc.
Proposed solution
An implicit variable is available within the card and is accessed the same way as the existing variables.
I propose the name: state.result (up to you of course).
It may make sense to populate this variable with a result for all other entity types too to promote and facilitate generic code.
e.g. hash, user, group, deviceID, and mediaquery
Thanks for this useful card. Guy