summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ebustest.py35
1 files changed, 31 insertions, 4 deletions
diff --git a/ebustest.py b/ebustest.py
index d6f84fd..767ed9c 100644
--- a/ebustest.py
+++ b/ebustest.py
@@ -37,7 +37,7 @@ deviceDescription = [
{'address':0x50, 'type':'slave', 'description':'Mischer 1'},
{'address':0x51, 'type':'slave', 'description':'Mischer 2'},
{'address':0x90, 'type':'slave', 'description':'Raumgeräte/Fernsteller 1'},
- {'address':0x90, 'type':'slave', 'description':'Raumgeräte/Fernsteller 2'},
+ {'address':0x91, 'type':'slave', 'description':'Raumgeräte/Fernsteller 2'},
{'address':0xfe, 'type':'broadcast', 'description':'Broadcast'},
]
@@ -60,7 +60,6 @@ packetDescription = [
{'primary':0x3, 'secondary':0x8, 'name':'Gesamtbrennstoffmengenzähle lesen'},
{'primary':''},
]
-
def formatHex(data):
return " ".join(map(lambda byte: "%.2x"%ord(byte), data))
@@ -91,6 +90,10 @@ class EbusPacket(object):
(self.__class__.__name__, self.name(), getDsc(self.source), getDsc(self.destination), \
self.primary_command, self.secondary_command, self.length)
+class EbusService5017(EbusPacket):
+ # Contains Solars Pumpe and Kollektor Temperatur
+
+
class EbusMasterMaster(EbusPacket):
def __init__(self, source, destination, primary_command, secondary_command, data):
EbusPacket.__init__(self, source, destination, primary_command, secondary_command)
@@ -160,8 +163,8 @@ class Fetcher(asynchat.async_chat):
payloadLength = ord(data[4])
payload = data[5:6+payloadLength]
#delete 0x50 packets for devel
- if (primaryCommand == ord("\x50")):
- return
+ #if (primaryCommand == ord("\x50")):
+# return
#print "PR SC NN D0 D1 D2 D3 D4 D5 D6 D7 ..."
#print "%.2x" % (primaryCommand,)
#print "%.2x %.2x %.2x %s" % (primaryCommand,secondaryCommand,payloadLength,"bla")
@@ -180,10 +183,34 @@ class Fetcher(asynchat.async_chat):
p = EbusBroadcast(source, destination, primaryCommand, secondaryCommand, payload)
print p
print "payload=%s" % formatHex(payload)
+ if (primaryCommand == 0x50 and secondaryCommand == 0x17):
+ print "Kollektor Temperatur: %s %f °C" % (formatHex(payload[2:4]),self.convertData2c(payload[2:4]))
else:
print "KOMISCHES ZEUG"
return
print ""
+ def convertData2c(self,data):
+
+ # low nibble x&0xf
+ # high nibble x>>4
+ """Beispiel für die Berechnung:
+ if ((x & 8000h) == 8000h) // y negativ
+ y = - [dez(High_Byte(!x)) 16 + dez(High_Nibble (Low_Byte (!x)))
+ + (dez(Low_Nibble (Low_Byte (!x))) +1 ) / 16]
+ else // y positiv
+ y = dez(High_Byte(x)) 16 + dez(High_ Nibble (Low Byte (x)))
+ + dez(Low_ Nibble (Low Byte (x))) / 16
+ """
+ print "%s" % (formatHex(data))
+ highByte = ord(data[1])
+ lowByte = ord(data[0])
+
+ if (0):
+ #return (!highByte)*16 + (!lowByte)>>4 + (((!lowByte)&0xf)+1)/16.0
+ return 0
+ else:
+ return highByte*16 + (lowByte>>4) + (lowByte&0xf)/16.0
+
Fetcher()
asyncore.loop()