I think you are better off using lambda - I have had some weird experiences with on_value_range:. For example, if it was above 50 and then next update it becomes 50, it evaluates as below: 50. And vice versa, if it’s below 50 and becomes 50, it evaluates as above:
I don’t know if it’s a bug, but at least I can understand the logic of lambda…
It’s mostly academic because in the environment where this sensor goes, 50 is not possible. It will be either below 20, or above 80. But, I am curious how someone would handle the =50 case.