Zehnder ComfoAir Q350 TR

Begonnen von Syon, 07 Dezember 2016, 18:24:22

Vorheriges Thema - Nächstes Thema

stixif

#60
Hi, und frohe Ostern

hat evtl. schon wer das script von Phill (ccfhem.py) auf
die neue pycomfoconnect version (0.4) umgebaut??
oder gibt es hier schon eine andere Lösung um die werte zu lesen
und befehle zu senden??

hab ganz frisch
pip3 install pycomfoconnect

pip3 install pycomfoconnect
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting pycomfoconnect
Using cached https://www.piwheels.org/simple/pycomfoconnect/pycomfoconnect-0.4-py3-none-any.whl (21 kB)
Requirement already satisfied: protobuf>=3.0.0 in /usr/local/lib/python3.7/dist-packages (from pycomfoconnect) (3.9.1)
Requirement already satisfied: six>=1.9 in /usr/lib/python3/dist-packages (from protobuf>=3.0.0->pycomfoconnect) (1.12.0)
Requirement already satisfied: setuptools in /usr/lib/python3/dist-packages (from protobuf>=3.0.0->pycomfoconnect) (40.8.0)
Installing collected packages: pycomfoconnect
Successfully installed pycomfoconnect-0.4


und die ccfhem.py von hier:
https://github.com/hme0354/lox2comfoconnectwithfhem/blob/main/ccfhem.py

bekomme nun aber diese Meldung im Log:

2021.04.04 20:27:02 3: FHEMStart return value: -1
2021.04.04 20:27:02 0: Featurelevel: 6
2021.04.04 20:27:02 0: Server started with 13 defined entities (fhem.pl:23904/2021-03-07 perl:5.028001 os:linux user:fhem pid:3686)
Traceback (most recent call last):
  File "/opt/fhem/scripts/ccfhem.py", line 561, in <module>
    main()
  File "/opt/fhem/scripts/ccfhem.py", line 499, in main
    comfoconnect.register_sensor(regno)
  File "/usr/local/lib/python3.7/dist-packages/pycomfoconnect/comfoconnect.py", line 176, in register_sensor
    raise Exception("Registering sensor %d with unknown type" % sensor_id)
Exception: Registering sensor 277 with unknown type
Exception in thread Thread-2:
Traceback (most recent call last):
  File "/usr/lib/python3.7/threading.py", line 917, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.7/threading.py", line 865, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/local/lib/python3.7/dist-packages/pycomfoconnect/comfoconnect.py", line 388, in _message_thread_loop
    self._handle_rpdo_notification(message)
  File "/usr/local/lib/python3.7/dist-packages/pycomfoconnect/comfoconnect.py", line 438, in _handle_rpdo_notification
    self.callback_sensor(message.msg.pdid, val)
  File "/opt/fhem/scripts/ccfhem.py", line 443, in callback_sensor
    setreading(var, value)
  File "/opt/fhem/scripts/ccfhem.py", line 411, in setreading
    fhemsend(cmd)
  File "/opt/fhem/scripts/ccfhem.py", line 398, in fhemsend
    fhem.send(msg.encode('ascii'))
UnicodeEncodeError: 'ascii' codec can't encode character '\xdf' in position 42: ordinal not in range(128)

Exception in thread Thread-3:
Traceback (most recent call last):
  File "/usr/lib/python3.7/threading.py", line 917, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.7/threading.py", line 865, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/local/lib/python3.7/dist-packages/pycomfoconnect/comfoconnect.py", line 388, in _message_thread_loop
    self._handle_rpdo_notification(message)
  File "/usr/local/lib/python3.7/dist-packages/pycomfoconnect/comfoconnect.py", line 438, in _handle_rpdo_notification
    self.callback_sensor(message.msg.pdid, val)
  File "/opt/fhem/scripts/ccfhem.py", line 443, in callback_sensor
    setreading(var, value)
  File "/opt/fhem/scripts/ccfhem.py", line 411, in setreading
    fhemsend(cmd)
  File "/opt/fhem/scripts/ccfhem.py", line 398, in fhemsend
    fhem.send(msg.encode('ascii'))
UnicodeEncodeError: 'ascii' codec can't encode character '\xdf' in position 42: ordinal not in range(128)

Exception in thread Thread-4:
Traceback (most recent call last):
  File "/usr/lib/python3.7/threading.py", line 917, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.7/threading.py", line 865, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/local/lib/python3.7/dist-packages/pycomfoconnect/comfoconnect.py", line 388, in _message_thread_loop
    self._handle_rpdo_notification(message)
  File "/usr/local/lib/python3.7/dist-packages/pycomfoconnect/comfoconnect.py", line 438, in _handle_rpdo_notification
    self.callback_sensor(message.msg.pdid, val)
  File "/opt/fhem/scripts/ccfhem.py", line 443, in callback_sensor
    setreading(var, value)
  File "/opt/fhem/scripts/ccfhem.py", line 411, in setreading
    fhemsend(cmd)
  File "/opt/fhem/scripts/ccfhem.py", line 398, in fhemsend
    fhem.send(msg.encode('ascii'))
UnicodeEncodeError: 'ascii' codec can't encode character '\xdf' in position 42: ordinal not in range(128)

Exception in thread Thread-5:
Traceback (most recent call last):
  File "/usr/lib/python3.7/threading.py", line 917, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.7/threading.py", line 865, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/local/lib/python3.7/dist-packages/pycomfoconnect/comfoconnect.py", line 388, in _message_thread_loop
    self._handle_rpdo_notification(message)
  File "/usr/local/lib/python3.7/dist-packages/pycomfoconnect/comfoconnect.py", line 438, in _handle_rpdo_notification
    self.callback_sensor(message.msg.pdid, val)
  File "/opt/fhem/scripts/ccfhem.py", line 443, in callback_sensor
    setreading(var, value)
  File "/opt/fhem/scripts/ccfhem.py", line 411, in setreading
    fhemsend(cmd)
  File "/opt/fhem/scripts/ccfhem.py", line 398, in fhemsend
    fhem.send(msg.encode('ascii'))
UnicodeEncodeError: 'ascii' codec can't encode character '\xdf' in position 42: ordinal not in range(128)

Exception in thread Thread-6:
Traceback (most recent call last):
  File "/usr/lib/python3.7/threading.py", line 917, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.7/threading.py", line 865, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/local/lib/python3.7/dist-packages/pycomfoconnect/comfoconnect.py", line 388, in _message_thread_loop
    self._handle_rpdo_notification(message)
  File "/usr/local/lib/python3.7/dist-packages/pycomfoconnect/comfoconnect.py", line 438, in _handle_rpdo_notification
    self.callback_sensor(message.msg.pdid, val)
  File "/opt/fhem/scripts/ccfhem.py", line 443, in callback_sensor
    setreading(var, value)
  File "/opt/fhem/scripts/ccfhem.py", line 411, in setreading
    fhemsend(cmd)
  File "/opt/fhem/scripts/ccfhem.py", line 398, in fhemsend
    fhem.send(msg.encode('ascii'))
UnicodeEncodeError: 'ascii' codec can't encode character '\xdf' in position 42: ordinal not in range(128)

Exception in thread Thread-7:
Traceback (most recent call last):
  File "/usr/lib/python3.7/threading.py", line 917, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.7/threading.py", line 865, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/local/lib/python3.7/dist-packages/pycomfoconnect/comfoconnect.py", line 388, in _message_thread_loop
    self._handle_rpdo_notification(message)
  File "/usr/local/lib/python3.7/dist-packages/pycomfoconnect/comfoconnect.py", line 438, in _handle_rpdo_notification
    self.callback_sensor(message.msg.pdid, val)
  File "/opt/fhem/scripts/ccfhem.py", line 443, in callback_sensor
    setreading(var, value)
  File "/opt/fhem/scripts/ccfhem.py", line 411, in setreading
    fhemsend(cmd)
  File "/opt/fhem/scripts/ccfhem.py", line 398, in fhemsend
    fhem.send(msg.encode('ascii'))
UnicodeEncodeError: 'ascii' codec can't encode character '\xdf' in position 42: ordinal not in range(128)

Exception in thread Thread-8:
Traceback (most recent call last):
  File "/usr/lib/python3.7/threading.py", line 917, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.7/threading.py", line 865, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/local/lib/python3.7/dist-packages/pycomfoconnect/comfoconnect.py", line 388, in _message_thread_loop
    self._handle_rpdo_notification(message)
  File "/usr/local/lib/python3.7/dist-packages/pycomfoconnect/comfoconnect.py", line 438, in _handle_rpdo_notification
    self.callback_sensor(message.msg.pdid, val)
  File "/opt/fhem/scripts/ccfhem.py", line 443, in callback_sensor
    setreading(var, value)
  File "/opt/fhem/scripts/ccfhem.py", line 411, in setreading
    fhemsend(cmd)
  File "/opt/fhem/scripts/ccfhem.py", line 398, in fhemsend
    fhem.send(msg.encode('ascii'))
UnicodeEncodeError: 'ascii' codec can't encode character '\xdf' in position 42: ordinal not in range(128)

Exception in thread Thread-9:
Traceback (most recent call last):
  File "/usr/lib/python3.7/threading.py", line 917, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.7/threading.py", line 865, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/local/lib/python3.7/dist-packages/pycomfoconnect/comfoconnect.py", line 388, in _message_thread_loop
    self._handle_rpdo_notification(message)
  File "/usr/local/lib/python3.7/dist-packages/pycomfoconnect/comfoconnect.py", line 438, in _handle_rpdo_notification
    self.callback_sensor(message.msg.pdid, val)
  File "/opt/fhem/scripts/ccfhem.py", line 443, in callback_sensor
    setreading(var, value)
  File "/opt/fhem/scripts/ccfhem.py", line 411, in setreading
    fhemsend(cmd)
  File "/opt/fhem/scripts/ccfhem.py", line 398, in fhemsend
    fhem.send(msg.encode('ascii'))
UnicodeEncodeError: 'ascii' codec can't encode character '\xdf' in position 42: ordinal not in range(128)

Exception in thread Thread-10:
Traceback (most recent call last):
  File "/usr/lib/python3.7/threading.py", line 917, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.7/threading.py", line 865, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/local/lib/python3.7/dist-packages/pycomfoconnect/comfoconnect.py", line 388, in _message_thread_loop
    self._handle_rpdo_notification(message)
  File "/usr/local/lib/python3.7/dist-packages/pycomfoconnect/comfoconnect.py", line 438, in _handle_rpdo_notification
    self.callback_sensor(message.msg.pdid, val)
  File "/opt/fhem/scripts/ccfhem.py", line 443, in callback_sensor
    setreading(var, value)
  File "/opt/fhem/scripts/ccfhem.py", line 411, in setreading
    fhemsend(cmd)
  File "/opt/fhem/scripts/ccfhem.py", line 398, in fhemsend
    fhem.send(msg.encode('ascii'))
UnicodeEncodeError: 'ascii' codec can't encode character '\xdf' in position 42: ordinal not in range(128)



die Readings kommen...


grüße
stixi
Rpi 3B + FHEM + Eltako FAM14 + Homematic

stixif

habs für mich lösen können...
mit aktueller comfoconnect Version (0.4)

hab mir hier einiges abgeschaut:
https://github.com/hme0354

ccfhem.py so angepasst:

#!/usr/bin/python3

### Version 0.0.1

import argparse
import socket
import ast

import sys
sys.stdout = None

from pycomfoconnect import *

#TODO check for version
#pip3 show pycomfoconnect | grep Version
#print(socket.__version__)

############# Argumentparsing and definition #################

pin = 0
local_name = 'FHEM'
local_uuid = bytes.fromhex('00000000000000000000000000000010')


parser = argparse.ArgumentParser()
parser.add_argument('--host', help='fhem server address. (localhost)')
parser.add_argument('--port', help='fhem telnet port. (7072)')
parser.add_argument('--servport', help='port to listen for commands. (7077)')
parser.add_argument('--ip', help='ip address of the comfocontrol bridge (auto)')
parser.add_argument('--fhemdummy', help='name of the fhem dummy (comfoconnect)')
args = parser.parse_args()

args.host = 'localhost' if args.host == None else args.host
args.port = 7072 if args.port == None else args.port

args.servport = 7077 if args.servport == None else args.servport
servhost = 'localhost'

args.fhemdummy = "comfoconnect" if args.fhemdummy == None else args.fhemdummy


conf = {
16 : {
  'NAME' : 'ModusAbwesend',
  'TYPE' : 1
},
# 33 : {
  # 'NAME' : 'Test33',
  # 'TYPE' : 1
# },
# 37 : {
  # 'NAME' : 'Test37',
  # 'TYPE' : 1
# },
49 : {
  'NAME' : 'Modus',
  'TYPE' : 1
},
# 53 : {
  # 'NAME' : 'Test53',
  # 'TYPE' : 1
# },
  56 : {
   'NAME' : 'ModusAutoManuell',
   'TYPE' : 1
  },
  65 : {
   'NAME' : 'Stufe',
   'TYPE' : 1,
   'CONV' : 'str(%i)[-1:]'
  },
  66 : {
   'NAME' : 'ModusBypass',
   'TYPE' : 1
  },
  67 : {
   'NAME' : 'ModusTemperaturprofil',
   'TYPE' : 1
  },
  70 : {
   'NAME' : 'ModusNurZuluftventilator',
   'TYPE' : 1
  },
  71 : {
   'NAME' : 'ModusNurAbluftventilator',
   'TYPE' : 1
  },
81 : {
  'NAME' : 'ZeitAllgemeinHex',
  'TYPE' : 3
},
82 : {
  'NAME' : 'ZeitBypassHex',
  'TYPE' : 3
},
# 85 : {
  # 'NAME' : 'Test85',
  # 'TYPE' : 3
# },
86 : {
  'NAME' : 'ZeitZuluftHEX',
  'TYPE' : 3
},
87 : {
  'NAME' : 'ZeitAbluftHEX',
  'TYPE' : 3
},
117 : {
   'NAME' : 'VentilatorLeistungAbluft',
   'TYPE' : 1,
   'UNIT' : '%'
  },
  118 : {
   'NAME' : 'VentilatorLeistungZuluft',
   'TYPE' : 1,
   'UNIT' : '%'
  },
  119 : {
   'NAME' : 'VentilatorVolumenAbluft',
   'TYPE' : 2,
   'UNIT' : 'm³/h'
  },
  120 : {
   'NAME' : 'VentilatorVolumenZuluft',
   'TYPE' : 2,
   'UNIT' : 'm³/h'
  },
  121 : {
   'NAME' : 'VentilatorDrehzahlAbluft',
   'TYPE' : 2,
   'UNIT' : 'U/min'
  },
  122 : {
   'NAME' : 'VentilatorDrehzahlZuluft',
   'TYPE' : 2,
   'UNIT' : 'U/min'
  },
  128 : {
   'NAME' : 'VerbrauchLueftungAktuell',
   'TYPE' : 2,
   'UNIT' : 'W'
  },
  129 : {
   'NAME' : 'VerbrauchLueftungLaufendesJahr',
   'TYPE' : 2  
  },
  130 : {
   'NAME' : 'VerbrauchLueftungGesamt',
   'TYPE' : 2
  },
# 144 : {
  # 'NAME' : 'VerbrauchVorheizregisterProJahr',
  # 'TYPE' : 2,
  # 'UNIT' : 'W'
# },
# 145 : {
  # 'NAME' : 'VerbrauchVorheizregisterGesamt',
  # 'TYPE' : 2,
  # 'UNIT' : 'kWh'
# },
# 146 : {
  # 'NAME' : 'LeistungVorheizregisterIST',
  # 'TYPE' : 2,
  # 'UNIT' : 'kWh'
# },
  176 : {
   'NAME' : 'SETTING RF PAIRING',
   'TYPE' : 1
  },
  192 : {
   'NAME' : 'ZeitFilterwechsel',
   'TYPE' : 2,
   'UNIT' : 'Tage'
  },
  208 : {
   'NAME' : 'EinstellungEinheitGUI',
   'TYPE' : 1
  },
  209 : {
    'NAME' : 'GrenztemeraturAktuell',
    'TYPE' : 6,
    'CONV' : "%i / 10",
    'UNIT' : '°C'
  },
  210 : {
   'NAME' : 'ModusHeizperiode',
   'TYPE' : 0
  },
  211 : {
   'NAME' : 'ModusKuehlperiode',
   'TYPE' : 0
  },
  212 : {
   'NAME' : 'TemperaturSollRegelung',
   'TYPE' : 6,
   'CONV' : "%i / 10",
   'UNIT' : '°C'
  },
  213 : {
   'NAME' : 'VerbrauchVermiedenerHeizstrom',
   'TYPE' : 2,
   'UNIT' : 'W'
  },
  214 : {
   'NAME' : 'VerbrauchVermiedenerHeizstromJahr',
   'TYPE' : 2,
   'UNIT' : 'kWh'
  },
  215 : {
   'NAME' : 'VerbrauchVermiedenerHeizstromGesamt',
   'TYPE' : 2,
   'UNIT' : 'kWh'
  },
# 219 : {
  # 'NAME' : 'LeistungVorheizregisterSOLL',
  # 'TYPE' : 2  
# },
  221 : {
   'NAME' : 'TemperaturZuluftInnen',
   'TYPE' : 6,
   'CONV' : "%i / 10",
   'UNIT' : '°C'
  },
# 224 : {
  # 'NAME' : 'Test224',
  # 'TYPE' : 1
# },
  225 : {
   'NAME' : 'ModusKomfortregelung',
   'TYPE' : 1
  },
# 226 : {
  # 'NAME' : 'Test226',
  # 'TYPE' : 2
# },
  227 : {
   'NAME' : 'ZustandBypass',
   'TYPE' : 1,
   'UNIT' : '%'
  },
  228 : {
   'NAME' : 'ZustandFrostschutzAusgleich',
   'TYPE' : 1
  },
  274 : {
   'NAME' : 'TemperaturAbluftInnen',
   'TYPE' : 6,
   'CONV' : "%i / 10",
   'UNIT' : '°C'
  },
  275 : {
   'NAME' : 'TemperaturAbluftAussen',
   'TYPE' : 6,
   'CONV' : "%i / 10",
   'UNIT' : '°C'
  },
  276 : {
   'NAME' : 'TemperaturZuluftAussen',
   'TYPE' : 6,
   'CONV' : "%i / 10",
   'UNIT' : '°C'
  },
# 277 : {
  # 'NAME' : 'TemperaturNachVorheizregister',
  # 'TYPE' : 6,
  # 'CONV' : "%i / 10",
  # 'UNIT' : '°C'
# },
  290 : {
   'NAME' : 'LuftfeuchteAbluftInnen',
   'TYPE' : 1,
   'UNIT' : '%'
  },
  291 : {
   'NAME' : 'LuftfeuchteAbluftAussen',
   'TYPE' : 1,
   'UNIT' : '%'
  },
  292 : {
   'NAME' : 'LuftfeuchteZuluftAussen',
   'TYPE' : 1,
   'UNIT' : '%'
  },
  # 293 : {
   # 'NAME' : 'LuftfeuchtNachVorheizregister',
   # 'TYPE' : 1,
   # 'UNIT' : '%'
  # },
  294 : {
   'NAME' : 'LuftfeuchteZuluftInnen',
   'TYPE' : 1,
   'UNIT' : '%'
  }
# 321 : {
  # 'NAME' : 'Test321',
  # 'TYPE' : 2
# },
# 325 : {
  # 'NAME' : 'Test325',
  # 'TYPE' : 3
# },
# 341 : {
  # 'NAME' : 'Test341',
  # 'TYPE' : 3
# },
# 369 : {
  # 'NAME' : 'Test369',
  # 'TYPE' : 1
# },
# 370 : {
  # 'NAME' : 'Test370',
  # 'TYPE' : 1
# },
# 371 : {
  # 'NAME' : 'Test371',
  # 'TYPE' : 1
# },
# 372 : {
  # 'NAME' : 'Test372',
  # 'TYPE' : 1
# },
# 384 : {
  # 'NAME' : 'Test384',
  # 'TYPE' : 6
# },
# 386 : {
  # 'NAME' : 'Test386',
  # 'TYPE' : 0
# },
# 400 : {
  # 'NAME' : 'Test400',
  # 'TYPE' : 6
# },
# 401 : {
  # 'NAME' : 'Test401',
  # 'TYPE' : 1
# },
# 402 : {
  # 'NAME' : 'Test402',
  # 'TYPE' : 0
# },
# 416 : {
  # 'NAME' : 'Test416',
  # 'TYPE' : 6
# },
# 417 : {
  # 'NAME' : 'Test417',
  # 'TYPE' : 6
# },
# 418 : {
  # 'NAME' : 'Test418',
  # 'TYPE' : 1
# },
# 419 : {
  # 'NAME' : 'Test419',
  # 'TYPE' : 0
# }

}


############# Create incomming connections #################

serv = socket.socket(socket.AF_INET, socket.SOCK_STREAM)

serv.bind((servhost, args.servport))
serv.listen(5)

print("Socket opened: %s listen to %s" % (servhost,args.servport))

def send(client, msg):
msg+="\r\n"
client.send(msg.encode('ascii'))


############# Create Outgoing FHEM connection ###################

print(args.host)
print(args.port)
fhem = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
fhem.connect((args.host, args.port))

def fhemsend(msg):
## fhem send here for comfoconnect requests
msg+="\r\n"
fhem.send(msg.encode('ascii'))

   
def setreading(var, value):
# setreading <devspec> <reading> <value>
#cmd = "setreading " + args.fhemdummy + " " + var + " " + value
#temp = eval(conf[var]['CONV'] % (val))
#print("%s hat %s " % (conf[var]['CONST'], temp))
if var in conf:
if 'CONV' in conf[var]:
value = eval(conf[var]['CONV'] % (value))
var = conf[var]['NAME']
cmd = "setreading %s %s %s" % (args.fhemdummy, str(var), str(value))
#print(cmd)
fhemsend(cmd)



############## Bridge discovery ###################################

def bridge_discovery():

    bridges = Bridge.discover(args.ip)
    if bridges:
        bridge = bridges[0]
    else:
        bridge = None

    # Method 3: Setup bridge manually
    # bridge = Bridge(args.ip, bytes.fromhex('0000000000251010800170b3d54264b4'))

    if bridge is None:
        print("No bridges found!")
        exit(1)

    print("Bridge found: %s (%s)" % (bridge.uuid.hex(), bridge.host))
    bridge.debug = True

    return bridge


################# Callback sensors ####################################

def callback_sensor(var, value):

    print("%s = %s" % (var, value))
    setreading(var, value)





def main():
    def request(req):
     if req.startswith("CMD_"):
      comfoconnect.cmd_rmi_request(eval(req))
     else:
      print("Unkown Command: " + req)
    # Discover the bridge
    bridge = bridge_discovery()

    ## Setup a Comfoconnect session  ###################################################################################

    comfoconnect = ComfoConnect(bridge, local_uuid, local_name, pin)
    comfoconnect.callback_sensor = callback_sensor

    try:
        # Connect to the bridge
        # comfoconnect.connect(False)  # Don't disconnect existing clients.
        comfoconnect.connect(True)  # Disconnect existing clients.

    except Exception as e:
        print('ERROR: %s' % e)
        exit(1)

    ## Register sensors ################################################################################################

    # comfoconnect.register_sensor(SENSOR_FAN_NEXT_CHANGE)  # General: Countdown until next fan speed change
    # comfoconnect.register_sensor(SENSOR_FAN_SPEED_MODE)  # Fans: Fan speed setting
    # comfoconnect.register_sensor(SENSOR_FAN_SUPPLY_DUTY)  # Fans: Supply fan duty
    # comfoconnect.register_sensor(SENSOR_FAN_EXHAUST_DUTY)  # Fans: Exhaust fan duty
    # comfoconnect.register_sensor(SENSOR_FAN_SUPPLY_FLOW)  # Fans: Supply fan flow
    # comfoconnect.register_sensor(SENSOR_FAN_EXHAUST_FLOW)  # Fans: Exhaust fan flow
    # comfoconnect.register_sensor(SENSOR_FAN_SUPPLY_SPEED)  # Fans: Supply fan speed
    # comfoconnect.register_sensor(SENSOR_FAN_EXHAUST_SPEED)  # Fans: Exhaust fan speed
    # comfoconnect.register_sensor(SENSOR_POWER_CURRENT)  # Power Consumption: Current Ventilation
    # comfoconnect.register_sensor(SENSOR_POWER_TOTAL_YEAR)  # Power Consumption: Total year-to-date
    # comfoconnect.register_sensor(SENSOR_POWER_TOTAL)  # Power Consumption: Total from start
    # comfoconnect.register_sensor(SENSOR_DAYS_TO_REPLACE_FILTER)  # Days left before filters must be replaced
    # comfoconnect.register_sensor(SENSOR_AVOIDED_HEATING_CURRENT)  # Avoided Heating: Avoided actual
    # comfoconnect.register_sensor(SENSOR_AVOIDED_HEATING_TOTAL_YEAR)  # Avoided Heating: Avoided year-to-date
    # comfoconnect.register_sensor(SENSOR_AVOIDED_HEATING_TOTAL)  # Avoided Heating: Avoided total
    # comfoconnect.register_sensor(SENSOR_TEMPERATURE_SUPPLY)  # Temperature & Humidity: Supply Air (temperature)
    # comfoconnect.register_sensor(SENSOR_TEMPERATURE_EXTRACT)  # Temperature & Humidity: Extract Air (temperature)
    # comfoconnect.register_sensor(SENSOR_TEMPERATURE_EXHAUST)  # Temperature & Humidity: Exhaust Air (temperature)
    # comfoconnect.register_sensor(SENSOR_TEMPERATURE_OUTDOOR)  # Temperature & Humidity: Outdoor Air (temperature)
    # comfoconnect.register_sensor(SENSOR_HUMIDITY_SUPPLY)  # Temperature & Humidity: Supply Air (temperature)
    # comfoconnect.register_sensor(SENSOR_HUMIDITY_EXTRACT)  # Temperature & Humidity: Extract Air (temperature)
    # comfoconnect.register_sensor(SENSOR_HUMIDITY_EXHAUST)  # Temperature & Humidity: Exhaust Air (temperature)
    # comfoconnect.register_sensor(SENSOR_HUMIDITY_OUTDOOR)  # Temperature & Humidity: Outdoor Air (temperature)
    # comfoconnect.register_sensor(SENSOR_BYPASS_STATE)  # Bypass state
    for regno in conf.keys():
       comfoconnect.register_sensor(regno)

    ## Execute functions ###############################################################################################

    # ListRegisteredApps
    devices=''
    for app in comfoconnect.cmd_list_registered_apps():
        # print('%s: %s' % (app['uuid'].hex(), app['devicename']))
        devices+=app['devicename']+" "
    setreading('registeredDevices', devices)


    # DeregisterApp
    # comfoconnect.cmd_deregister_app(bytes.fromhex('00000000000000000000000000000001'))

    # VersionRequest
    version = comfoconnect.cmd_version_request()
    for key in version:
      setreading(key, version[key])
    # TimeRequest
    #timeinfo = comfoconnect.cmd_time_request()
    #print(timeinfo)

    ## Executing functions #############################################################################################

#     comfoconnect.cmd_rmi_request(CMD_FAN_MODE_AWAY)  # Go to away mode
#     comfoconnect.cmd_rmi_request(CMD_FAN_MODE_LOW)  # Set fan speed to 1
#     comfoconnect.cmd_rmi_request(CMD_FAN_MODE_MEDIUM)  # Set fan speed to 2
#     comfoconnect.cmd_rmi_request(CMD_FAN_MODE_HIGH)  # Set fan speed to 3

    ## Example interaction #############################################################################################

    try:
        print('Waiting... Stop with CTRL+C')
        while True:
            # Callback messages will arrive in the callback method.
            clien,addr = serv.accept()
            print("Got a connection from %s" % str(addr))
            send(clien, "Connection accepted")
            msg=clien.recv(1024)
            # commandhandler here
            strdec=str(msg.decode('ascii'))
            print ('Message received: ' + strdec)
            request(strdec)
            clien.close()

            if not comfoconnect.is_connected():
                print('We are not connected anymore...')




    except KeyboardInterrupt:
        pass

    ## Closing the session #############################################################################################

    fhem.close()
    comfoconnect.disconnect()


if __name__ == "__main__":
    main()




und die const.py so:

# Commands
CMD_FAN_MODE_AWAY               = b'\x84\x15\x01\x01\x00\x00\x00\x00\x01\x00\x00\x00\x00'
CMD_FAN_MODE_LOW                = b'\x84\x15\x01\x01\x00\x00\x00\x00\x01\x00\x00\x00\x01'
CMD_FAN_MODE_MEDIUM             = b'\x84\x15\x01\x01\x00\x00\x00\x00\x01\x00\x00\x00\x02'
CMD_FAN_MODE_HIGH               = b'\x84\x15\x01\x01\x00\x00\x00\x00\x01\x00\x00\x00\x03'
CMD_MODE_AUTO                   = b'\x85\x15\x08\x01'
CMD_MODE_MANUAL                 = b'\x84\x15\x08\x01\x00\x00\x00\x00\x01\x00\x00\x00\x01'
CMD_VENTMODE_STOP_SUPPLY_FAN_1  = b'\x84\x15\x07\x01\x00\x00\x00\x00\x10\x0e\x00\x00\x01' # Stoppt Supply-Fan für 1h
CMD_START_SUPPLY_FAN            = b'\x85\x15\x07\x01'
CMD_VENTMODE_STOP_EXHAUST_FAN_1 = b'\x84\x15\x06\x01\x00\x00\x00\x00\x10\x0e\x00\x00\x01' # Stoppt Exhaust-Fan für 1h
CMD_START_EXHAUST_FAN           = b'\x85\x15\x06\x01'
CMD_TEMPPROF_NORMAL             = b'\x84\x15\x03\x01\x00\x00\x00\x00\xff\xff\xff\xff\x00'
CMD_TEMPPROF_COOL               = b'\x84\x15\x03\x01\x00\x00\x00\x00\xff\xff\xff\xff\x01'
CMD_TEMPPROF_WARM               = b'\x84\x15\x03\x01\x00\x00\x00\x00\xff\xff\xff\xff\x02'
CMD_BYPASS_ON                   = b'\x84\x15\x02\x01\x00\x00\x00\x00\x10\x0e\x00\x00\x01'
CMD_BYPASS_OFF                  = b'\x84\x15\x02\x01\x00\x00\x00\x00\x10\x0e\x00\x00\x02'
CMD_BYPASS_AUTO                 = b'\x85\x15\x02\x01'
CMD_SENSOR_TEMP_OFF             = b'\x03\x1d\x01\x04\x00'
CMD_SENSOR_TEMP_AUTO            = b'\x03\x1d\x01\x04\x01'
CMD_SENSOR_TEMP_ON              = b'\x03\x1d\x01\x04\x02'
CMD_SENSOR_HUMC_OFF             = b'\x03\x1d\x01\x06\x00'
CMD_SENSOR_HUMC_AUTO            = b'\x03\x1d\x01\x06\x01'
CMD_SENSOR_HUMC_ON              = b'\x03\x1d\x01\x06\x02'
CMD_SENSOR_HUMP_OFF             = b'\x03\x1d\x01\x07\x00'
CMD_SENSOR_HUMP_AUTO            = b'\x03\x1d\x01\x07\x01'
CMD_SENSOR_HUMP_ON              = b'\x03\x1d\x01\x07\x02'
CMD_BOOST_MODE_1                = b'\x84\x15\x01\x06\x00\x00\x00\x00\x08\x07\x00\x00\x03'   # Partymode 0.5h
CMD_BOOST_MODE_2                = b'\x84\x15\x01\x06\x00\x00\x00\x00\x10\x0E\x00\x00\x03'   # Partymode 1h
CMD_BOOST_MODE_3                = b'\x84\x15\x01\x06\x00\x00\x00\x00\x20\x1C\x00\x00\x03'   # Partymode 2h
CMD_BOOST_MODE_4                = b'\x84\x15\x01\x06\x00\x00\x00\x00\x30\x2A\x00\x00\x03'   # Partymode 3h
CMD_BOOST_MODE_5                = b'\x84\x15\x01\x06\x00\x00\x00\x00\x40\x38\x00\x00\x03'   # Partymode 4h
CMD_BOOST_MODE_6                = b'\x84\x15\x01\x06\x00\x00\x00\x00\x50\x46\x00\x00\x03'   # Partymode 5h
CMD_BOOST_MODE_7                = b'\x84\x15\x01\x06\x00\x00\x00\x00\x60\x54\x00\x00\x03'   # Partymode 6h
CMD_BOOST_MODE_8                = b'\x84\x15\x01\x06\x00\x00\x00\x00\x80\x70\x00\x00\x03'   # Partymode 8h
CMD_BOOST_MODE_0                = b'\x85\x15\x01\x06'                                       # End Partymode

# Sensor locations

SENSOR_AWAY = 16
Test_33 = 33
Test_37 = 37
SENSOR_OPERATING_MODE_BIS = 49
Test_53 = 53
SENSOR_OPERATING_MODE = 56
SENSOR_FAN_SPEED_MODE = 65
SENSOR_BYPASS_MODE = 66
SENSOR_PROFILE_TEMPERATURE = 67
SENSOR_FAN_MODE_SUPPLY = 70
SENSOR_FAN_MODE_EXHAUST = 71
SENSOR_FAN_NEXT_CHANGE = 81
SENSOR_BYPASS_NEXT_CHANGE = 82
Test_85 = 85
SENSOR_SUPPLY_NEXT_CHANGE = 86
SENSOR_EXHAUST_NEXT_CHANGE = 87
SENSOR_FAN_EXHAUST_DUTY = 117
SENSOR_FAN_SUPPLY_DUTY = 118
SENSOR_FAN_SUPPLY_FLOW = 119
SENSOR_FAN_EXHAUS_FLOW = 120
SENSOR_FAN_EXHAUST_SPEED = 121
SENSOR_FAN_SUPPLY_SPEED = 122
SENSOR_POWER_CURRENT = 128
SENSOR_POWER_TOTAL_YEAR = 129
SENSOR_POWER_TOTAL = 130
SENSOR_PREHEATER_POWER_TOTAL_YEAR = 144
SENSOR_PREHEATER_POWER_TOTAL = 145
SENSOR_PREHEATER_POWER_CURRENT = 146
SENSOR_SETTING_RF_PAIRING = 176
SENSOR_DAYS_TO_REPLACE_FILTER = 192
Test_208 = 208
SENSOR_CURRENT_RMOT = 209
SENSOR_HEATING_SEASON = 210
SENSOR_COOLING_SEASON = 211
SENSOR_TARGET_TEMPERATURE = 212
SENSOR_AVOIDED_HEATING_CURRENT = 213
SENSOR_AVOIDED_HEATING_TOTAL_YEAR = 214
SENSOR_AVOIDED_HEATING_TOTAL = 215
SENSOR_AVOIDED_COOLING_CURRENT = 216
SENSOR_AVOIDED_COOLING_YEAR = 217
SENSOR_AVOIDED_COOLING_TOTAL = 218
SENSOR_AVOIDED_COOLING_CURRENT_Target = 219
SENSOR_TEMPERATURE_SUPPLY = 221
Test_224 = 224
SENSOR_COMFORTCONTROL_MODE = 225
Test_226 = 226
SENSOR_BYPASS_STATE = 227
SENSOR_FROSTPROTECTION_UNBALANCE = 228
SENSOR_TEMPERATURE_EXTRACT = 274
SENSOR_TEMPERATURE_EXHAUST = 275
SENSOR_TEMPERATURE_OUTDOOR = 276
SENSOR_TEMPERATURE_AFTER_PREHEATER = 277
SENSOR_HUMIDITY_EXTRACT = 290
SENSOR_HUMIDITY_EXHAUST = 291
SENSOR_HUMIDITY_OUTDOOR = 292
SENSOR_HUMIDITY_AFTER_PREHEATER = 293
SENSOR_HUMIDITY_SUPPLY = 294
TEST_321 = 321
TEST_325 = 325
TEST_341 = 341
TEST_369 = 369
TEST_370 = 370
TEST_371 = 371
TEST_372 = 372
TEST_384 = 384
TEST_386 = 386
TEST_400 = 400
TEST_401 = 401
TEST_402 = 402
TEST_416 = 416
TEST_417 = 417
TEST_418 = 418
TEST_419 = 419


nun läuft das ganze bisher stabil
und solange sich die APP nicht eingewählt hat,
funktionieren auch die befehle

grüße
stixi
Rpi 3B + FHEM + Eltako FAM14 + Homematic

hme0354

@stixif meld dich beim Beta Programm von Zehnder an, dann kannst du APP und FHEM gleichzeitig nutzen.

Nun eine Frage meiner Seits. Bei einem Kumpel haben wir versucht alles zu installieren. Er bekommt alle Daten schön in FHEM rein, aber keine Befehle raus. Auch nicht direkt über die Comandline am raspberry. Wenn ich einen Befehl da eingebe, bekomm ich zurück "Connection accepted". Bei ihm hängt es sich auf. Hat jemand einen Tipp?

stixif

Das mit den befehlen ging bei mir erst mit der aktuellen Version
Und wenn keine Fehler mehr im Log waren...

Rpi 3B + FHEM + Eltako FAM14 + Homematic

hme0354

Interessant ist, dass er alle Daten FHEM reinbekommen und die auch aktualisiert werden, aber keine Befehle senden kann.

stixif

#65
Zitat von: hme0354 am 06 April 2021, 18:00:59
Interessant ist, dass er alle Daten FHEM reinbekommen und die auch aktualisiert werden, aber keine Befehle senden kann.

hatte selbes verhalten bis zum anpassen!

und natürlich wenn kein Neustart von FHEM nach APP login...
(brauch ich aber i Zukunft nicht mehr... war nur zum prüfen)

ahh und "phyton wheel" ist drauf...
war auch mal in irgend einer anleitung...
Rpi 3B + FHEM + Eltako FAM14 + Homematic

stixif

Hi Zusammen,

bei mir wollte die Lüftungsanlage nicht mehr ausgelesen werden...
somit hab ich mich  nun mit der neuen Version von
https://github.com/michaelarnauts/aiocomfoconnect
auseinandergesetzt

und mir diese Scripte erstellt!
https://github.com/stixif/FHEM-aiocomfoconnect

wem es was hilft darfs gerne nutzen wer weitere Verbesserungen hat darf diese natürlich einfließen lassen
Rpi 3B + FHEM + Eltako FAM14 + Homematic

Hanjo

Zitat von: stixif am 26 April 2023, 22:27:31und mir diese Scripte erstellt!
https://github.com/stixif/FHEM-aiocomfoconnect
Wow, nice, danke! Ich hatte gar nicht mitbekommen, dass es da eine neue Bibliothek gibt. Das werde ich in den nächsten Tagen direkt mal ausprobieren.

stixif

freut mich wenns wem hilft...
Rpi 3B + FHEM + Eltako FAM14 + Homematic

innasa

#69
Hallo, ich habe das aiocomfoconnect ans laufen bekommen, vielen Dank für deinen Input. Mir fehlen allerdings die Sensoren 215 und 218 (Avoided Heating: Avoided total und Avoided Cooling Total), kannst du mir einen Tipp geben wo ich die nachpflegen kann?^
In der Sensors.py ist der Sensor aufgeführt, ich verzweifele aber daran ihns in FHEM zu bekommen.

Vielen Dank.

Edit: Hab das Script im Debug laufen lassen, dort kommen die Werte korrekt raus. Kann es sein, dass das Reading wegen der Klammer nicht angelegt wird?

innasa

Falls jemand mal selbst das Problem hat: Ich habe aus den Namen in der Sensors.py alle Klammern entfernt, dann sind alle Readings angelegt worden!