Thank you for explaining that. Adding round(0) fixes it. I’ll send a correction to the yaml to the dev to update their wiki.
Here is the final corrected condition:
{% if (state_attr('light.alexa_virtual', 'brightness') | int / 255 * 100 ) | round(0) | int == 1 %}
Side question for understanding…
Does | int round using floor?
I ask because…
When I have state_attr('light.alexa_virtual', 'brightness') = 10 without round(0) it comes out to 3, but when I add | round(0) it comes out to the expected 4.
{{ 26 | int / 255 * 100 | int }} = 3 <- Incorrect {{ 26 | int / 255 * 100 | round(0) | int }} = 4 <- Correct
What does | int do that does not have the expected behavior?
If you add double-quotes outside of the template, the Template Editor will report it is a string. However, that’s just the way the Template Editor works and doesn’t mean the template’s result will be handled as a string when the template is used elsewhere.