Hey David, I've been working on something similar for the Sungrow SH5K inverter talking through the Modbus protocol. From looking over your code briefly, it's an almost 2000 line script, I can't easily make sense of what your logic is.
I'd take the long list of initializations out as a dictionary in another py file and write an abstract function for code blocks like this. @property def PowerApparent_S_Phase_1(self): if (self._checkdatacurrency(self .MeterRealTimeData.PowerApparent_S_Phase_1)): return self.MeterRealTimeData.PowerApparent_S_Phase_1.Value else: self._GetMeterRealtimeData() return self.MeterRealTimeData.PowerApparent_S_Phase_1.Value @property def PowerApparent_S_Phase_2(self): if (self._checkdatacurrency(self .MeterRealTimeData.PowerApparent_S_Phase_2)): return self.MeterRealTimeData.PowerApparent_S_Phase_2.Value else: self._GetMeterRealtimeData() return self.MeterRealTimeData.PowerApparent_S_Phase_2.Value Cheers, Dave On Fri, May 18, 2018 at 2:05 PM, William ML Leslie < william.leslie....@gmail.com> wrote: > On 18 May 2018 at 13:40, paul sorenson <new...@metrak.com> wrote: > > My inverter came with a CD-ROM which would push a cloud somewhere but I > > reckon it would be fun to crowd source really granular data. > > > > The ability to push clouds is a great feature for a solar inverter to have. > > -- > William Leslie > > Notice: > Likely much of this email is, by the nature of copyright, covered > under copyright law. You absolutely MAY reproduce any part of it in > accordance with the copyright law of the nation you are reading this > in. Any attempt to DENY YOU THOSE RIGHTS would be illegal without > prior contractual agreement. > _______________________________________________ > melbourne-pug mailing list > melbourne-pug@python.org > https://mail.python.org/mailman/listinfo/melbourne-pug >
_______________________________________________ melbourne-pug mailing list melbourne-pug@python.org https://mail.python.org/mailman/listinfo/melbourne-pug