python-iot-sdk for guozhiyun
Project description
jucie-python-sdk
项目介绍
果汁云IOT的Python SDK 主项目:https://gitee.com/haonan108/juice-cloud JAVA-SDK:https://gitee.com/haonan108/juice-java-sdk
安装教程
- 安装python环境(>2.6)
- pip install guozhi
使用说明
- 以下可直接连接到guozhiyun平台
from juice.MqttClient import MqttClient
from juice.handler.extend.sensor.SoudSetHandler import SoudSetHandler
from juice.handler.extend.device.TempGetHandler import TempGetHandler
get_handler_dict = {'temp': TempGetHandler()} # 读取设备温度
set_handler_dict = {'soud': SoudSetHandler()} # 设置蜂鸣器(传感器)状态
if __name__ == '__main__':
# 填入产品code、设备code、密钥(需在www.guozhiyun.cn上申请)
mqtt = MqttClient('product_code', 'device_code', 'secret')
mqtt.get_message = get_handler_dict
mqtt.set_message = set_handler_dict
mqtt.init()
- 扩展Handler,需要继承PropGetHandler或PropSetHandler,并实现handle方法,可参考SoudSetHandler,TempGetHandler
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
guozhi-0.1.6.tar.gz
(8.2 kB
view hashes)