agb007
1
Hi,
I tried to change colour depending on a value and get this error.
Error: string > float not implemented
temp_in = data['state']
if temp_in > 20.0:
col_in="#a00" # röd
else:
col_in="#0a0" # grön
I know that the value is in the format xx.x
Any suggestions?
Thanks
inxi
2
You need to convert the string to a float. For example:
if float(temp_in) > 20.0:
1 Like
agb007
3
Thanks!
It worked if I did like this
if float(temp_in) > 20:
I wonder a little bit if i wanted to use the decimal how would that look since it did not accept 20.0
inxi
4
Out of curiosity, what error do you get? I don’t have the full context of your program, but that statement works for me with the decimal.
agb007
5
Very strange I must say.
Today when I tried it works as it should even with a decimal.
Strange