Closed sonicmingit closed 1 year ago
There is no issue with xiaomi_raw
. It works well on this device. It is just python-miio
that haven't supported it yet.
waiting for adding this function into python-miio
I'm trying to access this plug in the API but without any luck.
from miio import ChuangmiPlug
plug = ChuangmiPlug("192.168.1.xxx", "xxxxxxxxxxxxxxxxxxxxxxxxxxx")
plug.on()
DeviceError: {'code': -9999, 'message': 'user ack `timeout'}`
Any ideas?
BTW, the raw requests from the console work fine, but I would like to use them in python
亲爱的@ms300
{"id":65028,"method":"get_properties","params":[{"did":"xxx","siid": 2, "piid": 1}]} {"id":65029, "method":"set_properties","params":[{"did":"xxx","siid": 2, "piid": 1,"value":true}]}
我如何使用它来控制我的插头(此代码与我在家庭助手或 Domoticz 的自动化配置中遇到的代码不同)?你能提供一个快速指南或一些关于学习如何应用你的代码并使我的套接字工作的提示吗?
亲爱的@ms300,你太酷了!谢谢!!!!你为我节省了时间和金钱,让我的早晨快乐!!!!经过一番谷歌搜索,我能够弄清楚如何使用您发送的代码!!!!
我会给那些不熟悉这个话题的人留下一个小说明:
- 在你的树莓派上安装 python-miio!
- 获取属性值 - 发送命令:
miiocli -d device --ip YOUR_DEVICE_IP --token YOUR_DEVICE_TOKEN raw_command get_properties "[{'did': 'MYDID', 'siid': 2, 'piid': 1 }]"
- 设置属性值(打开!) - 发送命令:(
miiocli -d device --ip YOUR_DEVICE_IP --token YOUR_DEVICE_TOKEN raw_command set_properties "[{'did': 'MYDID', 'siid': 2, 'piid': 1, 'value':True}]"
注意,True 必须用大 T 写)- 如何与 MIOT 设备通信的指南 -> 插件? #901按照此链接查找可帮助您更深入理解这一点的说明。
hello,i got some troubles when i run it,the result shows error:code:-9999, user act timeout, i dont know how to solve it
I'm trying to access this plug in the API but without any luck.
from miio import ChuangmiPlug plug = ChuangmiPlug("192.168.1.xxx", "xxxxxxxxxxxxxxxxxxxxxxxxxxx") plug.on() DeviceError: {'code': -9999, 'message': 'user ack `timeout'}`
Any ideas?
BTW, the raw requests from the console work fine, but I would like to use them in python
metoo,have you solved this problem?
I'm trying to access this plug in the API but without any luck.
from miio import ChuangmiPlug plug = ChuangmiPlug("192.168.1.xxx", "xxxxxxxxxxxxxxxxxxxxxxxxxxx") plug.on() DeviceError: {'code': -9999, 'message': 'user ack `timeout'}`
Any ideas? BTW, the raw requests from the console work fine, but I would like to use them in python
metoo,have you solved this problem?
Maybe you guys can try this code:
from miio.device import Device
plug = Device("DEVICE_IP", "DEVICE_TOKEN")
print(plug.send("set_properties", [{'did': 'MYDID', 'siid': 2, 'piid': 1, 'value':True}]))
我正在尝试在 API 中访问此插件,但没有任何运气。
from miio import ChuangmiPlug plug = ChuangmiPlug("192.168.1.xxx", "xxxxxxxxxxxxxxxxxxxxxxxxxxx") plug.on() DeviceError: {'code': -9999, 'message': 'user ack `timeout'}`
有任何想法吗? 顺便说一句,来自控制台的原始请求工作正常,但我想在 python 中使用它们
metoo,你解决了这个问题吗?
也许你们可以试试这个代码:
from miio.device import Device plug = Device("DEVICE_IP", "DEVICE_TOKEN") print(plug.send("set_properties", [{'did': 'MYDID', 'siid': 2, 'piid': 1, 'value':True}]))
thank u for ur reply,i'v already solve this
Device information:
Name(s) of the device: Mi Smart Power Plug 2 (Wi-Fi and Bluetooth Gateway)
Link: https://www.mi.com/buy/detail?product_id=12777
Model: chuangmi.plug.212a01
Hardware version: esp32
Firmware version: 2.1.0_0017