I have the following issue with variables & javascript on a custom:button-card.
In the ‘variables’ section the following code works fine:
R: |
[[[
{
var n = (entity.state * 1.27 / 5580) * 100;
return ((255 * (100 - n)) / 100) | 0;
}
]]]
G: |
[[[
{
var n = (entity.state * 1.27 / 5580) * 100;
return ((255 * n) / 100) | 0;
}
]]]
But when I replace the dividing value by a variable, it doesn’t:
d: 5580
R: |
[[[
{
var n = (entity.state * 1.27 / variables.d) * 100;
return ((255 * (100 - n)) / 100) | 0;
}
]]]
G: |
[[[
{
var n = (entity.state * 1.27 / variables.d) * 100;
return ((255 * n) / 100) | 0;
}
]]]
What am I missing?