Page 1 of 1

Adding two variables together

PostPosted: Tue May 28, 2019 2:39 pm
by mwoodage
Hello,
I've nearly managed to sort this out myself, but just need some help with the last bit! I'm writing a python script to add two variables together.

I'm trying to take a temperature reading from our hot tub, but the only place i can mount the probe gives a temperature reading that's 3 degrees lower than the actual temperature. So i've written the following which adds both variables together but it doesn't bring across the .68 (or what ever the figure after the decimal point is).

Can anyone help with how to transfer the .68 across?

Code: Select all
hottubtemp = int(float(indigo.variables[394455824].value))
hottubtempset = int(float(indigo.variables[1175215717].value))
hottubtempact = hottubtemp + hottubtempset
indigo.variable.updateValue(1590980300, value=str(float(hottubtempact)))


Thanks in advance
Martin

Re: Adding two variables together

PostPosted: Tue May 28, 2019 4:16 pm
by racarter
Remove the ints. You’re converting the first two numbers to integers, which always rounds down. Since you’ll then be adding two floats you won’t need the float on the last line.

Re: Adding two variables together

PostPosted: Wed May 29, 2019 6:18 am
by mwoodage
racarter wrote:
Remove the ints. You’re converting the first two numbers to integers, which always rounds down. Since you’ll then be adding two floats you won’t need the float on the last line.


That works! Thank you so much, its easy when you know how :lol:

Martin

Re: Adding two variables together

PostPosted: Wed May 29, 2019 6:30 am
by racarter
Happy to help :)