Python script to not output below zero
Posted: Wed Apr 19, 2023 2:23 am
Hello,
I'm after some help with the following script, everything works well, but the output will go into a minus figure at some points during the day, but i'd like it to stop when it gets to zero.
Is there something i can add to the end of the script to stop it from going lower than zero?
Thanks in advance
Martin
I'm after some help with the following script, everything works well, but the output will go into a minus figure at some points during the day, but i'd like it to stop when it gets to zero.
Is there something i can add to the end of the script to stop it from going lower than zero?
- Code: Select all
Roof_Solar_Battery_Combined = int(float(indigo.variables[7675940965].value))
Immersion_Power = int(float(indigo.variables[2887052].value))
Battery_Power = int(float(indigo.variables[7292602006].value))
Available_Power = Roof_Solar_Battery_Combined - Immersion_Power - Battery_Power
indigo.variable.updateValue(3319680207, value=str (float(Available_Power)))
Thanks in advance
Martin