Created
January 9, 2018 09:22
-
-
Save unverbraucht/14da08e0cf7a64e86605a9869afc2be9 to your computer and use it in GitHub Desktop.
Quick sample to reproduce json escaping with pyhomematic. Please replace PASSWORD with a valid password of the CCU.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
import sys | |
import logging | |
from pyhomematic import HMConnection | |
logging.basicConfig(level=logging.DEBUG) | |
def systemcallback(src, *args): | |
print(src) | |
for arg in args: | |
print(arg) | |
try: | |
pyhomematic = HMConnection(systemcallback=systemcallback, autostart=True, remotes={"local":{"ip":"192.168.32.242", "port": 2001, "username":"Admin", "password": "PASSWORD"}}) | |
except Exception: | |
sys.exit(1) | |
sleepcounter = 0 | |
def eventcallback(address, interface_id, key, value): | |
print("CALLBACK: %s, %s, %s, %s" % (address, interface_id, key, value)) | |
while not pyhomematic.devices and sleepcounter < 20: | |
print("Waiting for devices") | |
sleepcounter += 1 | |
time.sleep(1) | |
print(pyhomematic.devices) | |
print(pyhomematic.getAllSystemVariables("local")) | |
# Stop the server thread so Python can exit properly. | |
pyhomematic.stop() | |
sys.exit(0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment