Seite 3 von 3

Re: Frage zu ISG Web Anbindung

Verfasst: So Sep 18, 2022 9:56 am
von okaegi
Ich habe ein separates python script gemacht, was regelmässig die wp ausliest in ein excel wegschreibt und die Jaz berechnet.

Output sieht so aus

Code: Alles auswählen

09/18/2022 11:30 Aus/Inn 14.00/23.02 Ku 1.19 Vor 56.50 H1 i/s 50.50/49.90 H2 i/s 27.10/27.10 Pu i/s 50.50/49.90 ww i/s 48.30/50.00 sg 1 Sw1 1 heiz/ww 1/0 abt/not 0/0 p1/p2 1/1 com 1 som 0 Zl   3582 Zw   9328 Jaz 2.60
09/18/2022 11:00 Aus/Inn 13.30/23.02 Ku 2.98 Vor 47.40 H1 i/s 43.30/49.60 H2 i/s 27.70/27.60 Pu i/s 43.30/49.60 ww i/s 48.40/50.00 sg 1 Sw1 1 heiz/ww 1/0 abt/not 0/0 p1/p2 1/1 com 1 som 0 Zl   3582 Zw   9328 Jaz 2.60
09/18/2022 10:30 Aus/Inn 12.40/23.02 Ku 2.72 Vor 40.60 H1 i/s 37.00/49.60 H2 i/s 28.20/28.20 Pu i/s 37.00/49.60 ww i/s 48.40/50.00 sg 1 Sw1 1 heiz/ww 1/0 abt/not 0/0 p1/p2 1/1 com 1 som 0 Zl   3582 Zw   9328 Jaz 2.60
09/18/2022 10:00 Aus/Inn 11.20/23.02 Ku 2.44 Vor 29.30 H1 i/s 28.70/49.60 H2 i/s 29.10/29.00 Pu i/s 28.70/49.60 ww i/s 48.40/50.00 sg 1 Sw1 1 heiz/ww 0/0 abt/not 0/0 p1/p2 0/1 com 0 som 0 Zl   3582 Zw   9328 Jaz 2.60
09/18/2022 09:30 Aus/Inn 10.80/23.02 Ku 0.70 Vor 31.60 H1 i/s 29.90/29.80 H2 i/s 29.10/29.20 Pu i/s 29.90/29.80 ww i/s 48.60/50.00 sg 1 Sw1 0 heiz/ww 0/0 abt/not 0/0 p1/p2 0/1 com 0 som 0 Zl   3582 Zw   9328 Jaz 2.60
09/18/2022 09:00 Aus/Inn 10.50/23.02 Ku 0.70 Vor 34.40 H1 i/s 35.30/30.00 H2 i/s 29.10/29.40 Pu i/s 35.30/30.00 ww i/s 48.70/50.00 sg 1 Sw1 0 heiz/ww 0/0 abt/not 0/0 p1/p2 0/1 com 0 som 0 Zl   3582 Zw   9328 Jaz 2.60
09/18/2022 08:30 Aus/Inn 10.00/23.02 Ku 0.70 Vor 34.40 H1 i/s 31.10/30.30 H2 i/s 28.60/29.70 Pu i/s 30.70/30.30 ww i/s 48.80/50.00 sg 1 Sw1 0 heiz/ww 1/0 abt/not 0/0 p1/p2 1/1 com 1 som 0 Zl   3582 Zw   9328 Jaz 2.60

Code: Alles auswählen

#!/usr/bin/python
import sys
import os
import time
import getopt
import socket
import ConfigParser
import struct
import binascii
from pymodbus.client.sync import ModbusTcpClient
debug = str(sys.argv[1])
named_tuple = time.localtime() # get struct_time
time_string = time.strftime("%m/%d/%Y %H:%M", named_tuple) 
file_string = time.strftime("/var/www/html/prod/dataStiebel%Y", named_tuple) 
ipaddress = '192.168.1.244'
client = ModbusTcpClient(ipaddress, port=502)
#Waermeenergie
resp= client.read_input_registers(3522,6,unit=1)
if debug == "1": print(time_string, ' start T3522', resp.registers)
#  vd heizen summe in kwh 3524 wp 1 
value1 = resp.registers[1]
all = format(value1, '04x')
hdwall1= int(struct.unpack('>h', all.decode('hex'))[0])  
#  vd heizen summe in mwh 3525 wp 1 
value1 = resp.registers[2]
all = format(value1, '04x')
hdwallm1= int(struct.unpack('>h', all.decode('hex'))[0]) 
#  vd ww summe in kwh 3527 wp 1 
value1 = resp.registers[4]
all = format(value1, '04x')
wwwall1= int(struct.unpack('>h', all.decode('hex'))[0])  
#  vd heizen summe in mwh 3528 wp 1 
value1 = resp.registers[5]
all = format(value1, '04x')
wwwallm1 = int(struct.unpack('>h', all.decode('hex'))[0])  
totalwwh = (hdwall1 + (hdwallm1  * 1000) + wwwall1 + (wwwallm1 * 1000)) * 1000
#
# leistungsaufnahme
resp= client.read_input_registers(3532,6,unit=1)
if debug == "1": print(time_string, ' start T3532', resp.registers)
# vd heizen tag in mwh 3533 wp 1 
value1 = resp.registers[0]
all = format(value1, '04x')
hdtag1 = int(struct.unpack('>h', all.decode('hex'))[0]) 
#  vd heizen summe in kwh 3534 wp 1 
value1 = resp.registers[1]
all = format(value1, '04x')
hdall1= int(struct.unpack('>h', all.decode('hex'))[0])  
#  vd heizen summe in mwh 3535 wp 1 
value1 = resp.registers[2]
all = format(value1, '04x')
hdallm1= int(struct.unpack('>h', all.decode('hex'))[0]) 
# vd ww tag in mwh 3536 wp 1 
value1 = resp.registers[3]
all = format(value1, '04x')
wwtag1 = int(struct.unpack('>h', all.decode('hex'))[0])  
#  vd ww summe in kwh 3537 wp 1 
value1 = resp.registers[4]
all = format(value1, '04x')
wwall1= int(struct.unpack('>h', all.decode('hex'))[0])  
#  vd heizen summe in mwh 3538 wp 1 
value1 = resp.registers[5]
all = format(value1, '04x')
wwallm1 = int(struct.unpack('>h', all.decode('hex'))[0])  
totalwh = (hdall1 + (hdallm1  * 1000) + wwall1 + (wwallm1 * 1000)) * 1000
# jahresanfanhzaehler 2021
totalkwhst = 5090
totalkwwhst = 14275
jaz = 2.80
#
# jahresanfanhzaehler 2022
totalkwhst = totalkwhst + 7097
totalkwwhst = totalkwwhst + 19104
jaz = 2.69
#
# jahresanfanhzaehler 2023
totalkwhst = totalkwhst + 0
totalkwwhst = totalkwwhst + 0
jaz = 0.0
#
totalkwh = (totalwh / 1000) - totalkwhst
totalkwwh  = (totalwwh / 1000) - totalkwwhst
if totalkwh > 0:
      jaz = float(totalkwwh) / float(totalkwh)
#
if debug == "1": 
            print(time_string,' vd tag %.2f vd all  k / m %.2f/%.2f ww tag %.2f ww all  k/m %.2f/%.2f' % (hdtag1,hdall1,hdallm1,wwtag1,wwall1,wwallm1))
            print(time_string,'total in watt',totalwh)
count1=1
if count1 > 0:
   count1=0
#manual ab 507
   resp= client.read_input_registers(506,18,unit=1)
#print(time_string, ' start T506', resp.registers)
# temp aussen 597
   value1 = resp.registers[0]
   all = format(value1, '04x')
   aussen = float(struct.unpack('>h', all.decode('hex'))[0]) / 10
#print (aussen)
   if aussen >= 0x8000: aussen -= 0x10000
# temp ist hk1 508 
   value1 = resp.registers[1]
   all = format(value1, '04x')
   hk1ist= float(struct.unpack('>h', all.decode('hex'))[0])  / 10
# temp soll hk1 509/510
   value1 = resp.registers[3]
   all = format(value1, '04x')
   hk1soll= float(struct.unpack('>h', all.decode('hex'))[0])  / 10
# temp ist hk2 511
   value1 = resp.registers[4]
   all = format(value1, '04x')
   hk2ist = float(struct.unpack('>h', all.decode('hex'))[0])  / 10
# temp soll hk2 512
   value1 = resp.registers[5]
   all = format(value1, '04x')
   hk2soll= float(struct.unpack('>h', all.decode('hex'))[0])  / 10
# temp ist vorlauf 515
   value1 = resp.registers[8]
   all = format(value1, '04x')
   vorlauf = float(struct.unpack('>h', all.decode('hex'))[0])  / 10
# temp ist puffer 518
   value1 = resp.registers[11]
   all = format(value1, '04x')
   puffist = float(struct.unpack('>h', all.decode('hex'))[0])  / 10
# temp soll puffer 518
   value1 = resp.registers[12]
   all = format(value1, '04x')
   puffsoll = float(struct.unpack('>h', all.decode('hex'))[0])  / 10
# temp ist wasser 522
   value1 = resp.registers[15]
   all = format(value1, '04x')
   wasist = float(struct.unpack('>h', all.decode('hex'))[0])  / 10
# temp soll wasser 523
   value1 = resp.registers[16]
   all = format(value1, '04x')
   wassoll = float(struct.unpack('>h', all.decode('hex'))[0])  / 10
#
   sg= client.read_holding_registers(4000,1,unit=1)
   value1 = sg.registers[0]
   all = format(value1, '04x')
   sgready = int(struct.unpack('>h', all.decode('hex'))[0]) 
   sg1= client.read_holding_registers(4001,1,unit=1)
   value1 = sg1.registers[0]
   all = format(value1, '04x')
   sgreadys1 = int(struct.unpack('>h', all.decode('hex'))[0])    
   
   st= client.read_input_registers(2500,1,unit=1)
   value1 = st.registers[0]
   all = format(value1, '04x')
   status= int(struct.unpack('>h', all.decode('hex'))[0]) 
#wp heizen, wp wasser
   if (status & 16):
      swheiz=1
   else:
      swheiz=0
#wp wasser
   if (status & 32):
      swheizww=1
   else:
      swheizww=0    
#wp notheiz
   if (status & 8):
      swnot=1
   else:
      swnot=0
#wp pump1
   if (status & 1):
      swp1=1
   else:
      swp1=0
#wp pump2
   if (status & 2):
      swp2=1
   else:
      swp2=0
#wp comp
   if (status & 64):
      swcomp=1
   else:
      swcomp=0
#wp summer
   if (status & 128):
      swsomm=1
   else:
      swsomm=0
# abtauen setztwn heizen auf 0
   if (status & 512):
      swabt = 1
      swheiz=0
      swheizww=0
   else:
      swabt = 0
   realwatth=0
   swrohr=0
   luft=0
   count5=0
   innen = 0.0
   kurve=0.0
   if os.path.isfile('/var/www/html/openWB/ramdisk/stiebelinnen9'): 
      f = open('/var/www/html/openWB/ramdisk/stiebelinnen9', 'r')
      innen=float(f.read())
      f.close()   
  #manual ab 1503
   resp= client.read_holding_registers(1503,1,unit=1)
   value1 = resp.registers[0]
   all = format(value1, '04x')
   kurve = float(struct.unpack('>h', all.decode('hex'))[0]) / 100
   f = open(/var/www/html/prod/data/Stiebel.log', 'a')
   print >>f,('%s Aus/Inn %.2f/%.2f Ku %.2f Vor %.2f H1 i/s %.2f/%.2f H2 i/s %.2f/%.2f Pu i/s %.2f/%.2f ww i/s %.2f/%.2f sg %1d Sw1 %1d heiz/ww %1d/%1d abt/not %1d/%1d p1/p2 %1d/%1d com %1d som %1d Zl %6d Zw %6d Jaz %.2f' % (time_string,aussen,innen,kurve,vorlauf,hk1ist,hk1soll,hk2ist,hk2soll,puffist,puffsoll,wasist,wassoll,sgready,sgreadys1,swheiz,swheizww,swabt,swnot,swp1,swp2,swcomp,swsomm, totalkwh ,totalkwwh,jaz))
   f.close()
   header1 = 'date,Aussentemp,Innentemp,Kurve,Vorlauftemp,Hk1ist,Hk1soll,Hk2ist,Hk2soll,Pufferist,Puffersoll,Wasserist,Wassersoll,sgready,Switch1,heizlauft,Wasserlauft,Abtaulauft,Notheizlauft,Pumpe1,Pumpe2,Compressor,Compresserzaehl,Sommer,Rohrheizung,Luefterleistung,aktuelleLeistung,TotalLeistung,Totalwaerme,Jaz'
   if os.path.isfile(file_string):
      f = open( file_string , 'a')
   else:   
      f = open( file_string , 'w')
      print >> f,(header1)
   print >>f,('%s,%.2f,%.2f,%.2f,%.2f,%.2f,%.2f,%.2f,%.2f,%.2f,%.2f,%.2f,%.2f,%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,%3d,%1d,%1d,%3d,%6d,%6d,%6d,%.2f' % (time_string,aussen,innen,kurve,vorlauf,hk1ist,hk1soll,hk2ist,hk2soll,puffist,puffsoll,wasist,wassoll,sgready,sgreadys1,swheiz,swheizww,swabt,swnot,swp1,swp2,swcomp,count5,swsomm,swrohr,luft,realwatth, totalkwh ,totalkwwh,jaz))
   f.close()
   
Die innentemperatur lese ich aus einem shelly temp Fühler aus. Am 1.1. Xx muss ich jeweils den aktuellen Zählerstand im script nachtragen, dass die jaz Berechnung stimmt und von vorne anfängt.
Gruss Oliver

Re: Frage zu ISG Web Anbindung

Verfasst: So Sep 18, 2022 10:14 am
von ruffieuxh
okaegi hat geschrieben: So Sep 18, 2022 9:56 am Ich habe ein separates python script gemacht, was regelmässig die wp ausliest in ein excel wegschreibt und die Jaz berechnet.


Die innentemperatur lese ich aus einem shelly temp Fühler aus. Am 1.1. Xx muss ich jeweils den aktuellen Zählerstand im script nachtragen, dass die jaz Berechnung stimmt und von vorne anfängt.
Gruss Oliver
Cool! Vielen Dank. Bin nicht so der Python Spezialist, aber anpassen würde ich hinkriegen. :-) Ev. würde ich das dann via Node-Red Automatisierung https://nodered.org/ rauslesen. Die haben ein Modbus Modul.

Re: Frage zu ISG Web Anbindung

Verfasst: So Sep 18, 2022 10:18 am
von okaegi
Excel sieht dann so aus

Code: Alles auswählen

date,Aussentemp,Innentemp,Kurve,Vorlauftemp,Hk1ist,Hk1soll,Hk2ist,Hk2soll,Pufferist,Puffersoll,Wasserist,Wassersoll,sgready,Switch1,heizlauft,Wasserlauft,Abtaulauft,Notheizlauft,Pumpe1,Pumpe2,Compressor,Compresserzaehl,Sommer,Rohrheizung,Luefterleistung,aktuelleLeistung,TotalLeistung,Totalwaerme,Jaz
11/15/2020 19:52,7.20,21.77,0.80,38.80,36.60,32.80,33.10,33.10,36.60,33.10,47.10,50.00,1,0,1,0,0,0,1,1,1,  0,0,0,  0,     0,  3559, 10307,2.90
11/15/2020 20:08,7.20,21.77,0.80,40.60,38.60,32.80,33.10,33.10,38.60,33.10,47.10,50.00,1,0,1,0,0,0,1,1,1,  0,0,0,  0,     0,  3559, 10307,2.90
11/15/2020 22:01,9.60,21.90,0.80,32.10,29.10,31.00,29.90,31.30,29.50,31.30,46.80,50.00,1,0,1,0,0,0,1,1,1,  0,0,0,  0,     0,  3559, 10307,2.90
11/15/2020 22:07,10.00,21.77,0.80,33.30,30.30,30.70,30.30,31.00,30.70,31.00,46.90,50.00,1,0,1,0,0,0,1,1,1,  0,0,0,  0,     0,  3559, 10307,2.90