button-card
button-card copied to clipboard
SetTimeout or SetInterval Support?
I have several datapoints I would like to show via a single custom_field.
Is some variation of the following example possible?
custom_fields:
status: |
[[[
function test() {
if (variables.idx > 2) {
variables.idx = 0
} else {
variables.idx++
}
}
setInterval(test, 7000);
return `<div
style="font-size: 14px;
font-weight: bold;
color: black;
">${variables.arr[variables.idx]}</div>`
]]]
The button card using the status field displays without errors, but the variable is not incrementing every 7 seconds.
You can inspire yourself from this comment https://github.com/custom-cards/button-card/issues/436#issuecomment-782891871