Chamberlain Garagentor Antrieb + Starter Kit

Hier mal ein schneller Ansatz:

  1. pymyq nach Anleitung installieren:
    (Achtung: nicht pip install sondern direkt mit python3.5 --> python3.5 -m pip …)

  2. Python Script im IPS Scriptordner anlegen (Status.py)


#!/usr/bin/python3.5

#IPS Kommunikation ueber RPS
import requests, json
from requests.auth import HTTPBasicAuth
...
# JSON-RPS zu IPS definieren
def IpsRpc(methodIps, paramIps):
    url = "http://127.0.0.1:82/api/"
    auth=HTTPBasicAuth('benutzer', 'passwort')   # username nicht codiert, bsp. johndoe@unknown.net
    headers = {'content-type': 'application/json'}

    payload = {
        "method": methodIps,
        "params": paramIps,
        "jsonrpc": "2.0",
        "id": "0",
    }
    response = requests.post(url, auth=auth, data=json.dumps(payload), headers=headers).json




#Beginn Auslesen
import asyncio
import logging

from aiohttp import ClientSession

from pymyq import login
from pymyq.errors import MyQError, RequestError

_LOGGER = logging.getLogger()

EMAIL = "mailadresse"
PASSWORD = "passwort"



async def main() -> None:
    """Create the aiohttp session and run the example."""
    logging.basicConfig(level=logging.INFO)
    async with ClientSession() as websession:
        try:
            # Create an API object:
            api = await login(EMAIL, PASSWORD, websession)

            # Get the account ID:
            #_LOGGER.info("Account ID: %s", api.account_id)

            # Get all devices listed with this account – note that you can use
            # api.covers to only examine covers:
            for idx, device_id in enumerate(api.covers):
                device = api.devices["CG081149FAE5"]
                #_LOGGER.info("---------")
                #_LOGGER.info("Device %s: %s", idx + 1, device.name)
                #_LOGGER.info("Device Online: %s", device.online)
                #_LOGGER.info("Device ID: %s", device.device_id)
                #_LOGGER.info("Parent Device ID: %s", device.parent_device_id)
                #_LOGGER.info("Device Family: %s", device.device_family)
                #_LOGGER.info("Device Platform: %s", device.device_platform)
                #_LOGGER.info("Device Type: %s", device.device_type)
                #_LOGGER.info("Firmware Version: %s", device.firmware_version)
                #_LOGGER.info("Open Allowed: %s", device.open_allowed)
                #_LOGGER.info("Close Allowed: %s", device.close_allowed)
                #_LOGGER.info("Current State: %s", device.state)
                IpsRpc("SetValue", [<IPS Variablen ID>, device.state])

        except MyQError as err:
            IpsRpc("SetValue", [<IPS Variablen ID>, err])


asyncio.get_event_loop().run_until_complete(main())


  1. String Variable in IPS anlegen. (Die ID muss im Script ergänzt werden

  2. Python über IPS aufrufen:
    shell_exec(„python status.py“);

Genau so geht man dann mit Open und Close vor. Schon funktioniert das ganze wieder.

Zugegeben nicht ganz einfach zu implementieren, jedoch machbar.
Ich werde das ganze mal ein paar Tage testen und euch informieren.

Gruß
Steffen

Hi Steffen

Habe es befürchtet…Wäre es möglich das du die vorgehensweise bei Windows postest?

Wäre sehr Dankbar dafür!

Hallo Wildsau,
Das Sollte ja nicht all zu schwer sein. Vorschlag… du bringst Python auf Windows zum laufen und ich unterstütze dich bei der Implementierung der Scripte.

Im übrigen läuft das ganze bei mir seit Implementierung ohne Fehler. Ich hoffe mal das jetzt zumindest eine Weile keiner was an der API ändert.

Gruß
Steffen