This repository has been archived by the owner on Feb 19, 2024. It is now read-only.
Grammar & functionality around InjectEntityProxy can be improved #79
Labels
📈 enhancement
New feature or request. Attach project label also
🏡 home assistant
@digital-alchemy/home-assistant
Issue
Clumsy grammar
It is far too easy to write comparisons that aren't obviously badly formatted at a casual read. Example code to demonstrate issue:
In this code, the
this.isLate?
ternary inget sceneHigh
will always choose thehigh_dimmed
scene, since the comparison is looking at an object and not a booleanMissing functionality
@InjectEntityProxy
only injects the whole object, and is intended to be paired withENTITY_STATE
to provide the type definitions. Again - confusing grammar.There is no ability to inject just the state, or a single attribute.
Proposed change
The type definitions and injector should be expanded to extract state / attributes, and coerce if needed. Examples:
Not illustrated in this example: conversion to date / dayjs for date strings, potentially others
The text was updated successfully, but these errors were encountered: