TD22057 / T-Home

Home automation integration
BSD 2-Clause "Simplified" License
23 stars 12 forks source link

error: unpack_from requires a buffer of at least 12 bytes #6

Closed jghaanstra closed 6 years ago

jghaanstra commented 6 years ago

I'm trying to test the sma code and read out my inverter but I'm getting the following error. Any clue what is going on?

2018-04-17 18:51:28,188 : ERROR: Report failed to run
Traceback (most recent call last):
  File "E:\Localhost\bin\WinPython2.7\python-2.7.13.amd64\lib\site-packages\tHome\sma\start.py", line 88, in start
    nextReport.func( client, linkArgs, config, log )
  File "E:\Localhost\bin\WinPython2.7\python-2.7.13.amd64\lib\site-packages\tHome\sma\start.py", line 133, in msgPower
    data = report.power( **linkArgs )
  File "E:\Localhost\bin\WinPython2.7\python-2.7.13.amd64\lib\site-packages\tHome\sma\report.py", line 26, in power
    obj = dc.decode( dcBytes )
  File "E:\Localhost\bin\WinPython2.7\python-2.7.13.amd64\lib\site-packages\tHome\sma\Reply.py", line 39, in decode
    offset += d.decodeItem( self, bytes, offset )
  File "E:\Localhost\bin\WinPython2.7\python-2.7.13.amd64\lib\site-packages\tHome\sma\Reply.py", line 143, in decodeItem
    self.struct.unpack( self, bytes, offset )
  File "E:\Localhost\bin\WinPython2.7\python-2.7.13.amd64\lib\site-packages\tHome\util\NamedStruct.py", line 45, in unpack
    data = self.struct.unpack_from( bytes, offset )
error: unpack_from requires a buffer of at least 12 bytes

Printing self in unpack() from util/NamedStruct.py gives me:

<tHome.util.NamedStruct.NamedStruct instance at 0x0000000004ED0808>
<tHome.util.NamedStruct.NamedStruct instance at 0x000000000585AF48>
TD22057 commented 6 years ago

See issue #2.

FYI - I don't live at that house anymore so I don't have access to an inverter or any way to test anything. I can help explain what's happening but clearly your inverter is sending different messages than mine is. If you follow the advice I gave in #2, you may be able to figure out what mods are required. Please update that issue instead of this one.