micolous / cbus

Use Python to communicate with a Clipsal C-Bus PCI or CNI! Includes MQTT bridge (for Home Assistant), PCI simulator, and reverse engineering notes.
http://cbus.readthedocs.org/
GNU Lesser General Public License v3.0
49 stars 27 forks source link

Issue with protocol decoding #2

Closed micolous closed 11 years ago

micolous commented 12 years ago
2012-06-02 00:04:10+0930 [-] recv: '050638000202B603'
2012-06-02 00:04:11+0930 [-] recv: '050638000107B5'
2012-06-02 00:04:13+0930 [-] recv: '0506380079073D'
2012-06-02 00:04:15+0930 [-] recv: '050638000202330103020466020566A9'
2012-06-02 00:04:15+0930 [-] recv: '05063800BD'
2012-06-02 00:04:15+0930 [-] Unhandled Error
        Traceback (most recent call last):
          File "/usr/local/lib/python2.6/dist-packages/twisted/python/log.py", line 84, in callWithLogger
            return callWithContext({"system": lp}, func, *args, **kw)
          File "/usr/local/lib/python2.6/dist-packages/twisted/python/log.py", line 69, in callWithContext
            return context.call({ILogContext: newCtx}, func, *args, **kw)
          File "/usr/local/lib/python2.6/dist-packages/twisted/python/context.py", line 118, in callWithContext
            return self.currentContext().callWithContext(ctx, func, *args, **kw)
          File "/usr/local/lib/python2.6/dist-packages/twisted/python/context.py", line 81, in callWithContext
            return func(*args,**kw)
        --- <exception caught here> ---
          File "/usr/local/lib/python2.6/dist-packages/twisted/internet/posixbase.py", line 586, in _doReadOrWrite
            why = selectable.doRead()
          File "/usr/local/lib/python2.6/dist-packages/twisted/internet/_posixserialport.py", line 62, in doRead
            return fdesc.readFromFD(self.fileno(), self.protocol.dataReceived)
          File "/usr/local/lib/python2.6/dist-packages/twisted/internet/fdesc.py", line 94, in readFromFD
            callback(output)
          File "/usr/local/lib/python2.6/dist-packages/twisted/protocols/basic.py", line 564, in dataReceived
            why = self.lineReceived(line)
          File "cbus/protocol/pciprotocol.py", line 89, in lineReceived
            self.decode_cbus_event(line)
          File "cbus/protocol/pciprotocol.py", line 140, in decode_cbus_event
            group_addr = ord(event_bytes[5])
        exceptions.IndexError: string index out of range
micolous commented 11 years ago

Was fixed long ago.

Issue was with null lighting application messages: they have a body but no SALs, which would break on the old version of the protocol decoder. This is no longer an issue.