ein sehr schöner Projektansatz - gefällt mir ausgesprochen gut! Einfache Beispiele zur Ansteuerung habe ich problemlos auf Anhieb hinbekommen.
Wo es bei mir leider noch nicht rund läuft ist das Event-Handling:
Code: Alles auswählen
import pmatic
ccu = pmatic.CCU(address="http://192.168.x.x", credentials=("xxx", "yyy"))
pmatic.logging("INFO")
devices = ccu.devices.query(device_type=["HM-Sec-SC"])
print(len(devices))
def print_summary_state(param):
print("%s" % param.channel.device.name)
devices.on_value_updated(print_summary_state)
if not devices:
print("Found no devices. Terminating.")
else:
print("Waiting for changes...")
ccu.events.init()
print("Init done.")
ccu.events.wait()
ccu.events.close()
2017-02-27 07:23:05,566 [ERROR] Exception in XML-RPC call newDevices('pmatic-0', ...):
Traceback (most recent call last):
File "/usr/lib/python3.4/xmlrpc/server.py", line 392, in _dispatch
func = self.funcs[method]
KeyError: 'newDevices'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.4/dist-packages/pmatic/events.py", line 349, in _dispatch
return func(*params)
File "/usr/local/lib/python3.4/dist-packages/pmatic/events.py", line 464, in newDevices
spec = normalize_spec(spec)
File "/usr/local/lib/python3.4/dist-packages/pmatic/events.py", line 444, in normalize_spec
new_key = key.lower().decode("utf-8")
AttributeError: 'str' object has no attribute 'decode'
Das Programm läuft dann zwar und reagiert auch auf Events - die Fehlermeldung würde ich aber trotzdem gerne wegbekommen (oder zumindest verstehen).
Hat diesbezüglich vielleicht jemand einen Tipp für mich?
Dankeschön!