-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
e.toLowerCase() is not a function #230
Comments
Here is an example that works, watching - type: custom:swiss-army-knife-card
aspectratio: 3/3
entities:
- entity: light.office_door_spotlight
- entity: light.office_door_spotlight
attribute: brightness
format: brightness
unit: "%"
- entity: light.office_door_spotlight
attribute: color_temp
format: color_temp
layout:
toolsets:
- toolset: 3_spotlight_triad
position:
cx: 50
cy: 50
tools:
- type: "circle"
entity_index: 2
position:
cx: 150
cy: 100
radius: 47
styles:
circle:
stroke: "var(--secondary-background-color)"
filter: url(#sak-nm-default)
animations:
- state: "[[[ return (state); ]]]"
styles:
circle:
filter: url(#nm-1-reverse)
fill: >-
[[[ return
`rgb(${states["light.office_door_spotlight"].attributes.rgb_color})`
]]]
- state: "off"
styles:
circle:
filter: url(#sak-nm-default)
- type: "circle"
entity_index: 0
position:
cx: 150
cy: 100
radius: 50
styles:
circle:
stroke: "var(--secondary-background-color)"
filter: url(#sak-nm-default)
animations:
- state: "on"
styles:
circle:
filter: url(#nm-1-reverse)
fill: url(#light-power-gradient-radial)
- state: "off"
styles:
circle:
filter: url(#sak-nm-default)
stroke: "var(--secondary-background-color)"
user_actions:
tap_action:
haptic: light
actions:
- action: call-service
service: light.toggle
hold_action:
haptic: light
actions:
- action: more-info |
The upcoming v2.5.1 converts all states to a string before processing, including attributes. That would automatically fix this bug. So in your case, the However:
|
Fantastic!
Using |
So far, even without JSON.*, the The new state string builder checks the current If the light is switched off, these attributes are removed by HA, and become I can't monitor more than 1 attribute for a single entity, but it works this way, so I'll keep it this way for now. The redesigned & rewritten state handling and state display makes all these things possible. State changes: state change --> convert state (convert:) --> new state as string. State display: new state --> format state (format:) --> localize state --> render state. It seems to work in my environment, but of course there will be bugs, as I can't test every situation. |
Closed due to #227 |
This works perfectly, thanks. |
Great. Thanks for the feedback! |
Bug report notice
Before you file a bug, make sure that you did not make a configuration mistake. The Swiss Army Knife in its current state does not yet have full configuration sanity checks!
So make sure your problem is not related to that!
Swiss Army Knife version
Bug description
When using an attribute of an entity that returns integers via an array, attempting to use this entity via
entity_index
andentity_indexes
results in the errore.toLowerCase() is not a function
. This occurs withrgb_color
, as well ashs_color
andxy_color
To Reproduce
Steps to reproduce the behavior:
Expected behavior
I expect the state to reflect the array returned. I actually desire to use this via an animation JS, e.g.
Desktop browser (please complete the following information):
The text was updated successfully, but these errors were encountered: