britkat1980 / giv_tcp

TCP connection (from inverter) and MQTT implementation
71 stars 32 forks source link

Define SuperTimezone and set to false if not running as Add On. #94

Closed PaddyTheShamrock closed 11 months ago

PaddyTheShamrock commented 11 months ago

Should fix #93. SuperTimezone is not defined unless the isAddon if statement is run. This causes a NameError Exception when the code is not running under Supervisor.

While it would be possible to put "if SuperTimezone: outp.write(" timezone=""+str(SuperTimezone)+""\n")" in a try->catch block or under another if statement, it's better to have a predefined variable to avoid the exception altogether. Setting it to false should allow your if statement to work as intended.

BrianUK6 commented 11 months ago

Was just about to add a PR for same problem - then saw this. So will not create PR. Just add SuperTimezone={} at line 53. Then it's "none" which is good for later test.