Feb-24-2021, 05:39 PM
Hi there,
my code is totally fine but only during day time :)
I basically do a GET request to a solar inverter that responds (during day time!) with the given energy the sun produces.
The code runs in a loop and checks this data every 30 seconds. This data is a number value and is saved into a variable.
Because I need to calculate something with these numbers I have to change the variable into an
The problem now is, that as soon as the sun is gone, the inverter does not respond with an
That means that every day when the sun is gone, my code crashes giving me an int error:
Maybe someone of you has an idea to solve this problem.
I would prefer if the
Thanks a lot for your help!
my code is totally fine but only during day time :)
I basically do a GET request to a solar inverter that responds (during day time!) with the given energy the sun produces.
The code runs in a loop and checks this data every 30 seconds. This data is a number value and is saved into a variable.
Because I need to calculate something with these numbers I have to change the variable into an
int(xxx)
.The problem now is, that as soon as the sun is gone, the inverter does not respond with an
"0"
(for zero energy) but with a text "null"
.That means that every day when the sun is gone, my code crashes giving me an int error:
TypeError: int() argument must be a string or a number, not 'NoneType'
Maybe someone of you has an idea to solve this problem.
I would prefer if the
"null"
would just be changed into an "0"
. As such my whole integration would work flawless again.Thanks a lot for your help!