blinker-library使用小爱同学查询传感器湿度失败
本帖最后由 geziang 于 2020-1-10 18:02 编辑基本信息
[*] 这个问题满足提问指南
[*] 我阅读了开发文档
[*] 我使用了最新的库及APP进行测试,但是问题仍然存在
[*] 我搜索过类似问题的解决方法但是仍然无法解决
[*] 有设备端的LOG信息
[*][] 有编译报错信息
[*] 我已填写基本信息
设备信息
[*]硬件:
[*]接入方式:
[*]package版本:
[*]blinker库版本:
[*]开发环境:
[*]操作系统:
IDE 中的设置
[*]Module:
[*]Flash Size:
[*]lwip Variant:
[*]CPU Frequency:
[*]Upload Using:
手机信息及APP信息
[*]华为Mate10
[*]android 10.0
[*]blinker App版本2.2.8
问题描述从编译到烧写配网一切正常,手机app也可以正确显示温度和湿度。但是,使用小爱同学查询温度时正常,查询湿度时失败,说“设备沟通失败”类似意思的话。硬件上只做了温湿度两个传感器,所以没有仔细测试其他的,但是初步测试其他传感器是能够播报程序里给的假数据的,只有湿度不行。另外,向小爱提问时可以看到硬件收到了请求的日志“MIOT Query codes: 0”和“MIOT Query All”
代码#define BLINKER_ESP_SMARTCONFIG
#define BLINKER_WIFI
#define BLINKER_MIOT_SENSOR
#include <Blinker.h>
char auth[] = "{这里是我的authkey}";
BlinkerNumber HUMI("humi");
BlinkerNumber TEMP("temp");
float humi_read = 20, temp_read = 20;
void miotQuery(int32_t queryCode)
{
BLINKER_LOG("MIOT Query codes: ", queryCode);
switch (queryCode)
{
case BLINKER_CMD_QUERY_ALL_NUMBER :
BLINKER_LOG("MIOT Query All");
BlinkerMIOT.temp(temp_read);
BlinkerMIOT.humi(humi_read);
BlinkerMIOT.pm25(20);
BlinkerMIOT.co2(20);
BlinkerMIOT.print();
break;
default :
BlinkerMIOT.temp(20);
BlinkerMIOT.humi(20);
BlinkerMIOT.pm25(20);
BlinkerMIOT.co2(20);
BlinkerMIOT.print();
break;
}
}
void heartbeat()
{
HUMI.print(humi_read);
TEMP.print(temp_read);
}
void dataRead(const String & data)
{
BLINKER_LOG("Blinker readString: ", data);
Blinker.vibrate();
uint32_t BlinkerTime = millis();
Blinker.print("millis", BlinkerTime);
}
void setup() {
Serial.begin(115200);
BLINKER_DEBUG.stream(Serial);BLINKER_DEBUG.debugAll();
Blinker.begin(auth);
Blinker.attachData(dataRead);
Blinker.attachHeartbeat(heartbeat);
BlinkerMIOT.attachQuery(miotQuery);
}
void loop() {
Blinker.run();
}
LOG信息 __ __ __/\ \ /\ \ __ /\ \ v0.3.3\ \ \___ \ \ \/\_\ ___\ \ \/'\ __ _ __ \ \ '__`\\ \ \ \/\ \ /' _ `\ \ , < /'__`\/\`'__\ \ \ \L\ \\ \ \_\ \ \/\ \/\ \ \ \\`\ /\__/\ \ \./ \ \_,__/ \ \__\\ \_\ \_\ \_\ \_\ \_\ \____\\ \_\ \/___/ \/__/ \/_/\/_/\/_/\/_/\/_/\/____/ \/_/ To better use blinker with your IoT project! Download latest blinker library here! => https://github.com/blinker-iot/blinker-library
_aliType: _duerType: &duerType=AIR_MONITOR _miType: &miType=sensor _authKey: 1ae1a31d0d43 Waiting for WiFi 20s, will enter SMARTCONFIG or APCONFIG while WiFi not connect! ESP8266_MQTT initialized... ============================================================================= Blinker Timer loaded! ==================Warning!EEPROM address 1536-2431 is used for Blinker Timer!============= DON'T USE THESE EEPROM ADDRESS! ========================================================================
countdown state: false _cdRunState: 0 _totalTime: 0 _runTime: 0 _action: loop state: false _lpRunState: 0 _times: 0 _tri_times: 0 _time1: 0 _action1: _time2: 0 _action2: _lpData: 0 WiFi Connected. IP Address: 192.168.3.58 begin: https://iot.diandeng.tech/api/v1/user/device/diy/auth?authKey={这里是我的authkey}&duerType=AIR_MONITOR&miType=sensor GET... code: 200 reply was: ============================== {"detail": {"broker": "aliyun", "deviceName": "190006900B82K2JSYWMBAJ4W", "iotId": "rtphQJHbX7rm6uXF79oP000000", "iotToken": "127240d2376242f9abfd299845093850", "productKey": "JgCGbHlndgz", "uuid": "714b3fc9da4d66954ea123767ee80b73"}, "message": 1000} ============================== ==================== DEVICE_NAME_MQTT: 190006900B82K2JSYWMBAJ4W MQTT_PRODUCTINFO_MQTT: JgCGbHlndgz MQTT_ID_MQTT: 190006900B82K2JSYWMBAJ4W MQTT_NAME_MQTT: rtphQJHbX7rm6uXF79oP000000 MQTT_KEY_MQTT: 127240d2376242f9abfd299845093850 MQTT_BROKER: aliyun HOST: public.iot-as-mqtt.cn-shanghai.aliyuncs.com PORT: 1883 UUID_MQTT: 714b3fc9da4d66954ea123767ee80b73 ==================== BLINKER_PUB_TOPIC_MQTT: /JgCGbHlndgz/190006900B82K2JSYWMBAJ4W/s BLINKER_SUB_TOPIC_MQTT: /JgCGbHlndgz/190006900B82K2JSYWMBAJ4W/r Freeheap: 10248 mDNS responder started webSocket_MQTT server started ws://190006900B82K2JSYWMBAJ4W.local:81 Current time: Fri Jan 10 16:03:34 2020
NTP time: 1578643414 time (millis() - ntpFreshTime): 4630 ntpGetTime: 0 1 ==== needInit ==== message: /share/device?deviceName=190006900B82K2JSYWMBAJ4W&key=1ae1a31d0d43 blinker server begin Freeheap: 32104 HTTPS begin: https://iot.diandeng.tech/api/v1/user/device/share/device?deviceName=190006900B82K2JSYWMBAJ4W&key={这里是我的authkey} HTTPS payload: /share/device?deviceName=190006900B82K2JSYWMBAJ4W&key={这里是我的authkey} status... code: 200 {"detail": {"users": []}, "message": 1000} payload: {"users":[]} sharers data: {"users":[]} load timing load timing taskCount: 0 freshTiming wDay: 5, nowMins: 963, nowSeconds: 57815 nextTask: 10apartSeconds: 28585 wDay: 5 cbackData: 10 change apartSeconds: 3600 Connecting to MQTT... MQTT Connected! Freeheap: 11288 millis: 6942, connect_time: 4632 MQTT conn init success Got: {"deviceType":"DiyArduino","data":{"get":"state"},"fromDevice":"MIOT","toDevice":"190006900B82K2JSYWMBAJ4W"} data: {"get":"state"} fromDevice: MIOT form MIOT MIOT parse data: {"get":"state"} MIOT Query codes: 0 MIOT Query All response to MIOT: {"temp":"20.00","humi":"20.00","pm25":"20","co2":"20"} isJson: {"data":{"temp":"20.00","humi":4 {"data":{"temp":"20.00","humi":"20.00","pm25":"20","co2":"20"},"fromDevice":"190006900B82K2JSYWMBAJ4W","toDevice":"MIOT_r","deviceType":"vAssistant"} ...OK! Freeheap: 9464 Got: {"deviceType":"DiyArduino","data":{"get":"state"},"fromDevice":"MIOT","toDevice":"190006900B82K2JSYWMBAJ4W"} data: {"get":"state"} fromDevice: MIOT form MIOT MIOT parse data: {"get":"state"} MIOT Query codes: 0 MIOT Query All response to MIOT: {"temp":"20.00","humi":"20.00","pm25":"20","co2":"20"} isJson: {"data":{"temp":"20.00","humi": {"data":{"temp":"20.00","humi":"20.00","pm25":"20","co2":"20"},"fromDevice":"190006900B82K2JSYWMBAJ4W","toDevice":"MIOT_r","deviceType":"vAssistant"} ...OK! Freeheap: 9464
不是bug,小爱方面湿度只接收整数,你传的浮点数。
建议下次使用我们提供的例程测试,我们例程是无误的。
奈何col 发表于 2020-1-11 00:09
不是bug,小爱方面湿度只接收整数,你传的浮点数。
建议下次使用我们提供的例程测试,我们例程是无误的。
...
好的,感谢回复,抱歉 奈何col 发表于 2020-1-11 00:09
不是bug,小爱方面湿度只接收整数,你传的浮点数。
建议下次使用我们提供的例程测试,我们例程是无误的。
...
你用小爱语音控制的时候有没有出现过
嗯,尝试了一下,先看看设备状态吧
这样的问题啊
串口输出为error none query function set! 奈何col 发表于 2020-1-11 00:09
不是bug,小爱方面湿度只接收整数,你传的浮点数。
建议下次使用我们提供的例程测试,我们例程是无误的。
...
请问通过小爱调用你们平台的限制是什么?限频次?还是排队优先级啊?
免费和付费各是多少?
用node-red搭了个东西控制家里氛围灯,小爱总是回复“设备不理小爱”,在node-red日志观察,get state请求基本上会在10秒后到达,这延迟。。。不太好玩啊。 KillingJacky 发表于 2020-4-12 22:54
请问通过小爱调用你们平台的限制是什么?限频次?还是排队优先级啊?
免费和付费各是多少?
用node-red搭 ...
没有限制,有用户反映手机小爱正常,但小爱音响不正常,原因暂时未知,不一定是我们的问题。
不清楚你说的get:state是指什么,如果是app和设备通信,10秒是不可能的,默认使用的是阿里broker,再慢也就几百ms,更可能是你程序问题,导致的。 奈何col 发表于 2020-4-13 00:11
没有限制,有用户反映手机小爱正常,但小爱音响不正常,原因暂时未知,不一定是我们的问题。
不清楚你说 ...
Blinder app与设备通信是没有问题,延迟不大,
那就说明你们与小爱的云云对接那里延迟有点大。
页:
[1]