Exemple #1
0
            ]
        }]
    }]
    """

    if isnutri:
        kdmate = KSX3267MateV2(opt, nutriinfo, "1", None)
    else:
        kdmate = KSX3267MateV2(opt, devinfo, "1", None)

    mate = Mate({}, [], "1", None)
    kdmate.start(mate.writeblk)
    print "mate started"

    time.sleep(10)
    req = Request(None)
    req.setcommand("1", CmdCode.DETECT_DEVICE, None)
    print "=======================================#1"
    kdmate.writeblk(req)
    print "=======================================#1"
    """
    time.sleep(1)
    req = Request(None)
    req.setcommand("1", CmdCode.CANCEL_DETECT, {})
    print "=======================================#2"
    kdmate.writeblk(req)
    print "=======================================#2"

    time.sleep(1)
    req = Request(None)
    req.setcommand("1", CmdCode.DETECT_DEVICE, None)
Exemple #2
0
            "dt":
            "nd",
            "children": [{
                "id": "11",
                "dk": "11",
                "dt": "sen"
            }, {
                "id": "12",
                "dk": "12",
                "dt": "act"
            }]
        }]
    }]

    mqttc = FarmosMate(option, devinfo, "1", None)
    mate = Mate({}, [], "1", None)
    mqttc.start(mate.writeblk)

    cmd = Request(1, None)
    cmd.setcommand(12, 'on', {})

    publish.single("cvtgate/1/req/1",
                   cmd.stringify(),
                   hostname="dev.jinong.co.kr")
    print("published")

    time.sleep(5)
    mqttc.stop()

    print("local tested.")
Exemple #3
0
    option = {
        "conn" : {"host" : "dev.jinong.co.kr", "port" : 1883, "keepalive" : 60},
        "db" : {"host": "localhost", "user": "******", "password": "******", "db": "open"},
        "mqtt" : {"svc" : "cvtgate", "id" : "1"},
        "area" : "local"
    }

    devinfo = [
        {"id" : "0", "dk" : "0", "dt": "gw", "children" : [
            {"id" : "1", "dk" : "1", "dt": "nd", "children" : [
                {"id" : "11", "dk" : "11", "dt": "sen"},
                {"id" : "12", "dk" : "12", "dt": "act"}
            ]}
        ]}
    ]

    mqttc = FarmosMate(option, devinfo, "1", None)
    mate = Mate({}, [], "1", None)
    mqttc.start(mate.writeblk)

    cmd = Request(1, None)
    cmd.setcommand(12, 'on', {})

    publish.single("cvtgate/1/req/1", cmd.stringify(), hostname="dev.jinong.co.kr")
    print "published"

    time.sleep(5)
    mqttc.stop()

    print "local tested."