Small changes, comments
This commit is contained in:
parent
4bc5398537
commit
34fca8c2d0
@ -32,36 +32,36 @@ while True:
|
|||||||
# return all values but slower
|
# return all values but slower
|
||||||
parsed_msgs = sml_frame.parse_frame()
|
parsed_msgs = sml_frame.parse_frame()
|
||||||
for msg in parsed_msgs:
|
for msg in parsed_msgs:
|
||||||
# prints a nice overview over the received values
|
print(msg.format_msg()) # prints a nice overview over the received values
|
||||||
print(msg.format_msg())
|
|
||||||
|
|
||||||
# In the parsed message the obis values are typically found like this
|
obis_values = parsed_msgs[1].message_body.val_list # In the parsed message the obis values are typically found like this
|
||||||
obis_values = parsed_msgs[1].message_body.val_list
|
|
||||||
|
|
||||||
# The obis attribute of the SmlListEntry carries different obis representations as attributes
|
list_entry = obis_values[3] # The obis attribute of the SmlListEntry carries different obis representations as attributes
|
||||||
list_entry = obis_values[3]
|
|
||||||
|
|
||||||
|
# Get values from obis list
|
||||||
heatPowerIn = int(obis_values[5].value*0.01)
|
heatPowerIn = int(obis_values[5].value*0.01)
|
||||||
heatEnergyIn = int(obis_values[2].value*0.0001)
|
heatEnergyIn = int(obis_values[2].value*0.0001)
|
||||||
heatEnergyInHT = int(obis_values[3].value*0.0001)
|
heatEnergyInHT = int(obis_values[3].value*0.0001)
|
||||||
heatEnergyInNT = int(obis_values[4].value*0.0001)
|
heatEnergyInNT = int(obis_values[4].value*0.0001)
|
||||||
|
|
||||||
|
# Print values to console
|
||||||
print("Heizung Wirkleistung aktuell: " + str(heatPowerIn) + "W")
|
print("Heizung Wirkleistung aktuell: " + str(heatPowerIn) + "W")
|
||||||
print("Heizung Energie bezug gesamt: " + str(heatEnergyIn) + "kWh")
|
print("Heizung Energie bezug gesamt: " + str(heatEnergyIn) + "kWh")
|
||||||
print("Heizung Energie bezug HT: " + str(heatEnergyInHT) + "kWh")
|
print("Heizung Energie bezug HT: " + str(heatEnergyInHT) + "kWh")
|
||||||
print("Heizung Energie bezug NT: " + str(heatEnergyInNT) + "kWh")
|
print("Heizung Energie bezug NT: " + str(heatEnergyInNT) + "kWh")
|
||||||
pointList.append( Point('power').field('heatPowerIn', heatPowerIn).time(pushTime, WritePrecision.S) )
|
pointList.append( Point('power').field('heatPowerIn', heatPowerIn).time(pushTime, WritePrecision.S) )
|
||||||
|
|
||||||
if energyCounter % 12 == 0: # Only add energy to db every 6th while loop (every minute)
|
# Only add energy to pointlist every 6th while loop (every minute)
|
||||||
|
if energyCounter % 6 == 0:
|
||||||
pointList.append( Point('energy').field('heatEnergyIn', heatEnergyIn).time(pushTime, WritePrecision.S) )
|
pointList.append( Point('energy').field('heatEnergyIn', heatEnergyIn).time(pushTime, WritePrecision.S) )
|
||||||
pointList.append( Point('energy').field('heatEnergyInHT', heatEnergyInHT).time(pushTime, WritePrecision.S) )
|
pointList.append( Point('energy').field('heatEnergyInHT', heatEnergyInHT).time(pushTime, WritePrecision.S) )
|
||||||
pointList.append( Point('energy').field('heatEnergyInNT', heatEnergyInNT).time(pushTime, WritePrecision.S) )
|
pointList.append( Point('energy').field('heatEnergyInNT', heatEnergyInNT).time(pushTime, WritePrecision.S) )
|
||||||
print("Energy in DB")
|
print("Energy in DB")
|
||||||
energyCounter = 0
|
energyCounter = 0
|
||||||
|
|
||||||
for point in pointList:
|
for point in pointList: # Print all points in pointlist
|
||||||
print(point)
|
print(point)
|
||||||
|
|
||||||
writeToDB(pointList)
|
writeToDB(pointList) # Write pointlist to db
|
||||||
|
|
||||||
time.sleep(5)
|
time.sleep(10) # Sleep 10 seconds before reading the next value
|
||||||
@ -32,30 +32,32 @@ while True:
|
|||||||
# return all values but slower
|
# return all values but slower
|
||||||
parsed_msgs = sml_frame.parse_frame()
|
parsed_msgs = sml_frame.parse_frame()
|
||||||
for msg in parsed_msgs:
|
for msg in parsed_msgs:
|
||||||
# prints a nice overview over the received values
|
print(msg.format_msg()) # prints a nice overview over the received values
|
||||||
print(msg.format_msg())
|
|
||||||
|
|
||||||
# In the parsed message the obis values are typically found like this
|
obis_values = parsed_msgs[1].message_body.val_list # In the parsed message the obis values are typically found like this
|
||||||
obis_values = parsed_msgs[1].message_body.val_list
|
|
||||||
|
|
||||||
# The obis attribute of the SmlListEntry carries different obis representations as attributes
|
list_entry = obis_values[3] # The obis attribute of the SmlListEntry carries different obis representations as attributes
|
||||||
list_entry = obis_values[3]
|
|
||||||
|
|
||||||
|
# Get values from obis list
|
||||||
officePowerIn = int(obis_values[3].value*0.01)
|
officePowerIn = int(obis_values[3].value*0.01)
|
||||||
officeEnergyIn = int(obis_values[2].value*0.0001)
|
officeEnergyIn = int(obis_values[2].value*0.0001)
|
||||||
|
|
||||||
|
# Print values to console
|
||||||
print("Büro Wirkleistung aktuell: " + str(officePowerIn) + "W")
|
print("Büro Wirkleistung aktuell: " + str(officePowerIn) + "W")
|
||||||
print("Büro Energie bezug gesamt: " + str(officeEnergyIn) + "kWh")
|
print("Büro Energie bezug gesamt: " + str(officeEnergyIn) + "kWh")
|
||||||
|
|
||||||
|
# Add Power value to pointlist
|
||||||
pointList.append( Point('power').field('officePowerIn', officePowerIn).time(pushTime, WritePrecision.S) )
|
pointList.append( Point('power').field('officePowerIn', officePowerIn).time(pushTime, WritePrecision.S) )
|
||||||
|
|
||||||
if energyCounter % 12 == 0: # Only add energy to db every 6th while loop (every minute)
|
# Only add energy to pointlist every 6th while loop (every minute)
|
||||||
|
if energyCounter % 6 == 0:
|
||||||
pointList.append( Point('energy').field('officeEnergyIn', officeEnergyIn).time(pushTime, WritePrecision.S) )
|
pointList.append( Point('energy').field('officeEnergyIn', officeEnergyIn).time(pushTime, WritePrecision.S) )
|
||||||
print("Energy in DB")
|
print("Energy in DB")
|
||||||
energyCounter = 0
|
energyCounter = 0
|
||||||
|
|
||||||
for point in pointList:
|
for point in pointList: # Print all points in pointlist
|
||||||
print(point)
|
print(point)
|
||||||
|
|
||||||
writeToDB(pointList)
|
writeToDB(pointList) # Write pointlist to db
|
||||||
|
|
||||||
time.sleep(5)
|
time.sleep(10) # Sleep 10 seconds before reading the next value
|
||||||
Loading…
x
Reference in New Issue
Block a user