コード例 #1
0
ファイル: __init__.py プロジェクト: jabesq/netatmo-api-python
def getStationMinMaxTH(station=None, module=None):
    from pyatmo import ClientAuth
    from smart_home.WeatherStation import DeviceList

    authorization = ClientAuth()
    devList = DeviceList(authorization)
    if not station:
        station = devList.default_station
    if module:
        mname = module
    else:
        mname = devList.stationByName(station)["module_name"]
    lastD = devList.lastData(station)
    if mname == "*":
        result = dict()
        for m in lastD.keys():
            if time.time() - lastD[m]["When"] > 3600:
                continue
            r = devList.MinMaxTH(module=m)
            result[m] = (r[0], lastD[m]["Temperature"], r[1])
    else:
        if time.time() - lastD[mname]["When"] > 3600:
            result = ["-", "-"]
        else:
            result = [lastD[mname]["Temperature"], lastD[mname]["Humidity"]]
        result.extend(devList.MinMaxTH(station, mname))
    return result
コード例 #2
0
ファイル: __init__.py プロジェクト: pjmaenh/pyvaillant
def getStationMinMaxTH(station=None, module=None):
    from pyvaillant import ClientAuth
    from smart_home.WeatherStation import DeviceList

    authorization = ClientAuth()
    devList = DeviceList(authorization)
    if not station:
        station = devList.default_station
    if module:
        mname = module
    else:
        mname = devList.stationByName(station)["module_name"]
    lastD = devList.lastData(station)
    if mname == "*":
        result = {}
        for m in lastD.keys():
            if time.time() - lastD[m]["When"] > 3600:
                continue
            r = devList.MinMaxTH(module=m)
            result[m] = (r[0], lastD[m]["Temperature"], r[1])
    else:
        if time.time() - lastD[mname]["When"] > 3600:
            result = ["-", "-"]
        else:
            result = [lastD[mname]["Temperature"], lastD[mname]["Humidity"]]
        result.extend(devList.MinMaxTH(station, mname))
    return result
コード例 #3
0
    from sys import exit, stdout, stderr

    if not _CLIENT_ID or not _CLIENT_SECRET or not _USERNAME or not _PASSWORD:
        stderr.write(
            "Library source missing identification arguments to check lnetatmo.py (user/password/etc...)"
        )
        exit(1)

    authorization = ClientAuth(
        scope=
        "read_station read_camera access_camera read_thermostat write_thermostat read_presence access_presence"
    )  # Test authentication method

    try:
        devList = DeviceList(authorization)  # Test DEVICELIST
    except NoDevice:
        if stdout.isatty():
            print(
                "lnetatmo.py : warning, no weather station available for testing"
            )
    else:
        devList.MinMaxTH()  # Test GETMEASUR

    try:
        Camera = CameraData(authorization)
    except NoDevice:
        if stdout.isatty():
            print("lnetatmo.py : warning, no camera available for testing")

    try: