Closed TimpP-Spb closed 1 year ago
easy, the entity is actually the third argument in the template function
easy, the entity is actually the third argument in the template function Could you please make example, becasue i can not understand how to do it
depth:
icon:
template: |
(value, entity, humidifier_entity) => {
if (humidifier_entity.attributes.humidifier.fault == 0)
return 'mdi:tray';
if (humidifier_entity.attributes.humidifier.fault == 1)
return 'mdi:tray-minus';
return 'mdi:tray-full';
}
unit: '%'
round: 0
max_value: 125
volume: 4
type: liters
I got this result, without icon
You will need to debug this yourself... probably you have an exception in the logic. Try returning an icon without any logic and see if it works
depth:
icon:
template: |
(value, entity, humidifier_entity) => {
return 'mdi:tray-full';
}
unit: '%'
round: 0
max_value: 125
volume: 4
type: liters
without logick it is work....
so you have a bug in your code.... check the console for errors that might give you a clue, but this is not an issue with the library
I checked it in cosole, and what i found If i try to read attribute like this foromat "humidifire_entity.attribute.state_update" - i am not get error message and i get attribute in console.
If i try to read attribute like this foromat "humidifire_entity.attribute.humidifire.fault" i getting error message:
VM7186:5 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'fault')
at Object.eval [as template] (eval at gc (mini-humidifier-bund…53019926311:1:32800), <anonymous>:5:76)
at hc.get icon [as icon] (mini-humidifier-bund…53019926311:1:34076)
at Lc.renderIcon (mini-humidifier-bund…53019926311:1:74750)
at Lc.renderIndicator (mini-humidifier-bund…53019926311:1:75276)
at mini-humidifier-bund…53019926311:1:75625
at Array.map (<anonymous>)
at Lc.render (mini-humidifier-bund…53019926311:1:75616)
at Lc.update (mini-humidifier-bund…53019926311:1:22077)
at Lc.performUpdate (mini-humidifier-bund…53019926311:1:12980)
at Lc.scheduleUpdate (mini-humidifier-bund…53019926311:1:12644)
eval @ VM7186:5
get icon @ mini-humidifier-bund…stag=253019926311:1
renderIcon @ mini-humidifier-bund…stag=253019926311:1
renderIndicator @ mini-humidifier-bund…stag=253019926311:1
(anonymous) @ mini-humidifier-bund…stag=253019926311:1
render @ mini-humidifier-bund…stag=253019926311:1
update @ mini-humidifier-bund…stag=253019926311:1
performUpdate @ mini-humidifier-bund…stag=253019926311:1
scheduleUpdate @ mini-humidifier-bund…stag=253019926311:1
(anonymous) @ mini-humidifier-bund…stag=253019926311:1
n @ mini-humidifier-bund…stag=253019926311:1
g @ mini-humidifier-bund…stag=253019926311:1
Promise.then (async)
n @ mini-humidifier-bund…stag=253019926311:1
f @ mini-humidifier-bund…stag=253019926311:1
(anonymous) @ mini-humidifier-bund…stag=253019926311:1
(anonymous) @ mini-humidifier-bund…stag=253019926311:1
_$E_ @ mini-humidifier-bund…stag=253019926311:1
requestUpdate @ mini-humidifier-bund…stag=253019926311:1
set @ mini-humidifier-bund…stag=253019926311:1
C @ mini-humidifier-bund…stag=253019926311:1
_$AI @ mini-humidifier-bund…stag=253019926311:1
m @ mini-humidifier-bund…stag=253019926311:1
T @ mini-humidifier-bund…stag=253019926311:1
_$AI @ mini-humidifier-bund…stag=253019926311:1
m @ mini-humidifier-bund…stag=253019926311:1
T @ mini-humidifier-bund…stag=253019926311:1
_$AI @ mini-humidifier-bund…stag=253019926311:1
Db @ mini-humidifier-bund…stag=253019926311:1
update @ mini-humidifier-bund…stag=253019926311:1
o.update @ card-mod.js?hacstag=190927524314:5
performUpdate @ mini-humidifier-bund…stag=253019926311:1
scheduleUpdate @ mini-humidifier-bund…stag=253019926311:1
(anonymous) @ mini-humidifier-bund…stag=253019926311:1
n @ mini-humidifier-bund…stag=253019926311:1
f @ mini-humidifier-bund…stag=253019926311:1
Promise.then (async)
n @ mini-humidifier-bund…stag=253019926311:1
f @ mini-humidifier-bund…stag=253019926311:1
(anonymous) @ mini-humidifier-bund…stag=253019926311:1
(anonymous) @ mini-humidifier-bund…stag=253019926311:1
_$E_ @ mini-humidifier-bund…stag=253019926311:1
requestUpdate @ mini-humidifier-bund…stag=253019926311:1
(anonymous) @ mini-humidifier-bund…stag=253019926311:1
n @ mini-humidifier-bund…stag=253019926311:1
f @ mini-humidifier-bund…stag=253019926311:1
(anonymous) @ mini-humidifier-bund…stag=253019926311:1
(anonymous) @ mini-humidifier-bund…stag=253019926311:1
setTimeout (async)
updateIndicators @ mini-humidifier-bund…stag=253019926311:1
set hass @ mini-humidifier-bund…stag=253019926311:1
value @ cec1ec6d.js:1
performUpdate @ styles.ts:370
scheduleUpdate @ styles.ts:370
_$EC @ styles.ts:370
await in _$EC (async)
requestUpdate @ styles.ts:370
set @ styles.ts:370
k @ styles.ts:370
_$AI @ styles.ts:370
m @ styles.ts:370
T @ styles.ts:370
_$AI @ styles.ts:370
S @ styles.ts:370
update @ styles.ts:370
performUpdate @ styles.ts:370
scheduleUpdate @ styles.ts:370
_$EC @ styles.ts:370
await in _$EC (async)
requestUpdate @ styles.ts:370
set @ styles.ts:370
(anonymous) @ styles.ts:370
value @ styles.ts:370
value @ home-assistant.ts:32
_$AE @ styles.ts:370
performUpdate @ styles.ts:370
scheduleUpdate @ styles.ts:370
_$EC @ styles.ts:370
await in _$EC (async)
requestUpdate @ styles.ts:370
set @ styles.ts:370
value @ styles.ts:370
(anonymous) @ styles.ts:370
s @ core.8b15dd5b.js:1
(anonymous) @ core.8b15dd5b.js:1
e.subscribeMessage.type @ core.8b15dd5b.js:1
(anonymous) @ core.8b15dd5b.js:1
_handleMessage @ core.8b15dd5b.js:1
if i try read attribute in developer tools in HA, i can read without problem
change humidifier_entity.attributes.humidifier.fault
to humidifier_entity.attributes["humidifier.fault"]
change
humidifier_entity.attributes.humidifier.fault
tohumidifier_entity.attributes["humidifier.fault"]
Thank you!!!!!! could you give me recomendation, which documentation is describe it?
this is just basic Javascript stuff, whoever implemented your humidifier integration should not have created a property with a dot inside of it to avoid such confusion
Dear friend,
i have some trouble how to change icon for depth, i can not undestand how to call necessary attribute for JS please help. below you can see my listing:
i want to check attribute humidifire.fault in entity "humidifier.deerma_jsq5_33be_humidifier" but i am not understand how....