查看: 279|回复: 2

[已解答] blinker-library使用小爱同学查询传感器湿度失败

[复制链接]
  • TA的每日心情
    开心
    2020-1-10 15:25
  • 签到天数: 1 天

    [LV.1]初来乍到

    发表于 2020-1-10 15:49 | 显示全部楼层 |阅读模式
    本帖最后由 geziang 于 2020-1-10 18:02 编辑

    基本信息
    • [x] 这个问题满足提问指南
    • [x] 我阅读了开发文档
    • [x] 我使用了最新的库及APP进行测试,但是问题仍然存在
    • [x] 我搜索过类似问题的解决方法但是仍然无法解决
    • [x] 有设备端的LOG信息
    • [] 有编译报错信息
    • [x] 我已填写基本信息
    设备信息
    • 硬件: [NodeMCU]
    • 接入方式: [WIFI]
    • package版本: [esp8266-arduino-2.6.3]
    • blinker库版本: [arduino 0.3.3]
    • 开发环境: [Arduino]
    • 操作系统: [Windows]
    IDE 中的设置
    • Module: [NodeMCU 1.0(ESP-12E Module)]
    • Flash Size: [4MB]
    • lwip Variant: [v2 Lower Memory]
    • CPU Frequency: [80Mhz]
    • Upload Using: [SERIAL]
    手机信息及APP信息
    • 华为Mate10
    • android 10.0
    • blinker App版本  2.2.8
    问题描述
    从编译到烧写配网一切正常,手机app也可以正确显示温度和湿度。但是,使用小爱同学查询温度时正常,查询湿度时失败,说“设备沟通失败”类似意思的话。硬件上只做了温湿度两个传感器,所以没有仔细测试其他的,但是初步测试其他传感器是能够播报程序里给的假数据的,只有湿度不行。
    另外,向小爱提问时可以看到硬件收到了请求的日志“MIOT Query codes: 0”和“MIOT Query All”

    代码

    kittenblock中小学创客名师推荐的图形化编程软件

    #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信息
    [66]
    __       __                __
    /\ \     /\ \    __        /\ \              v0.3.3
    \ \ \___ \ \ \  /\_\    ___\ \ \/'\      __   _ __   
    \ \ '__`\\ \ \ \/\ \ /' _ `\ \ , <    /'__`\/\`'__\
      \ \ \L\ \\ \ \_\ \ \/\ \/\ \ \ \\`\ /\  __/\ \ \./
       \ \_,__/ \ \__\\ \_\ \_\ \_\ \_\ \_\ \____\\ \_\  
        \/___/   \/__/ \/_/\/_/\/_/\/_/\/_/\/____/ \/_/  
        To better use blinker with your IoT project!
        Download latest blinker library here!
        => https://github.com/blinker-iot/blinker-library

    [100] _aliType:
    [101] _duerType: &duerType=AIR_MONITOR
    [105] _miType: &miType=sensor
    [107] _authKey: 1ae1a31d0d43
    [614] Waiting for WiFi 20s, will enter SMARTCONFIG or APCONFIG while WiFi not connect!
    [2114] ESP8266_MQTT initialized...
    [2114]
    ===========================================================
    ================== Blinker Timer loaded! ==================
    Warning!EEPROM address 1536-2431 is used for Blinker Timer!
    ============= DON'T USE THESE EEPROM ADDRESS! =============
    ===========================================================

    [2135] countdown state: false
    [2136] _cdRunState: 0
    [2138] _totalTime: 0
    [2140] _runTime: 0
    [2141] _action:
    [2144] loop state: false
    [2145] _lpRunState: 0
    [2147] _times: 0
    [2149] _tri_times: 0
    [2151] _time1: 0
    [2152] _action1:
    [2154] _time2: 0
    [2156] _action2:
    [2157] _lpData: 0
    [2159] WiFi Connected.
    [2161] IP Address:
    [2163] 192.168.3.58
    [2175] [HTTP] begin: https://iot.diandeng.tech/api/v1/user/device/diy/auth?authKey={这里是我的authkey}&duerType=AIR_MONITOR&miType=sensor
    [3536] [HTTP] GET... code: 200
    [3543] reply was:
    [3543] ==============================
    [3543] {"detail": {"broker": "aliyun", "deviceName": "190006900B82K2JSYWMBAJ4W", "iotId": "rtphQJHbX7rm6uXF79oP000000", "iotToken": "127240d2376242f9abfd299845093850", "productKey": "JgCGbHlndgz", "uuid": "714b3fc9da4d66954ea123767ee80b73"}, "message": 1000}
    [3560] ==============================
    [3564] ====================
    [3566] DEVICE_NAME_MQTT: 190006900B82K2JSYWMBAJ4W
    [3570] MQTT_PRODUCTINFO_MQTT: JgCGbHlndgz
    [3574] MQTT_ID_MQTT: 190006900B82K2JSYWMBAJ4W
    [3578] MQTT_NAME_MQTT: rtphQJHbX7rm6uXF79oP000000
    [3582] MQTT_KEY_MQTT: 127240d2376242f9abfd299845093850
    [3587] MQTT_BROKER: aliyun
    [3590] HOST: public.iot-as-mqtt.cn-shanghai.aliyuncs.com
    [3595] PORT: 1883
    [3596] UUID_MQTT: 714b3fc9da4d66954ea123767ee80b73
    [3601] ====================
    [3603] BLINKER_PUB_TOPIC_MQTT: /JgCGbHlndgz/190006900B82K2JSYWMBAJ4W/s
    [3610] BLINKER_SUB_TOPIC_MQTT: /JgCGbHlndgz/190006900B82K2JSYWMBAJ4W/r
    [3616] Freeheap: 10248
    [3622] mDNS responder started
    [3623] webSocket_MQTT server started
    [3624] ws://190006900B82K2JSYWMBAJ4W.local:81
    [4629] Current time: Fri Jan 10 16:03:34 2020

    [4629] NTP time: 1578643414
    [4630] time (millis() - ntpFreshTime): 4630
    [4630] ntpGetTime: 0
    [4631] 1
    [4632] ==== needInit ====
    [4634] message: /share/device?deviceName=190006900B82K2JSYWMBAJ4W&key=1ae1a31d0d43
    [4642] blinker server begin
    [4644] Freeheap: 32104
    [5631] HTTPS begin: https://iot.diandeng.tech/api/v1/user/device/share/device?deviceName=190006900B82K2JSYWMBAJ4W&key={这里是我的authkey}
    [5631] HTTPS payload: /share/device?deviceName=190006900B82K2JSYWMBAJ4W&key={这里是我的authkey}
    [5639] [HTTP] status... code: 200
    [5644] {"detail": {"users": []}, "message": 1000}
    [5647] payload: {"users":[]}
    [5651] sharers data: {"users":[]}
    [5653] load timing
    [5655] load timing taskCount: 0
    [5657] freshTiming wDay: 5, nowMins: 963, nowSeconds: 57815
    [5662] nextTask: 10  apartSeconds: 28585 wDay: 5
    [5667] cbackData: 10
    [5668] change apartSeconds: 3600
    [5772] Connecting to MQTT...
    [6942] MQTT Connected!
    [6942] Freeheap: 11288
    [6943] millis: 6942, connect_time: 4632
    [6943] MQTT conn init success
    [25608] Got: {"deviceType":"DiyArduino","data":{"get":"state"},"fromDevice":"MIOT","toDevice":"190006900B82K2JSYWMBAJ4W"}
    [25609] data: {"get":"state"}
    [25611] fromDevice: MIOT
    [25613] form MIOT
    [25635] MIOT parse data: {"get":"state"}
    [25635] MIOT Query codes: 0
    [25636] MIOT Query All
    [25637] response to MIOT: {"temp":"20.00","humi":"20.00","pm25":"20","co2":"20"}
    [25640] isJson: {"data":{"temp":"20.00","humi":4
    [25740] {"data":{"temp":"20.00","humi":"20.00","pm25":"20","co2":"20"},"fromDevice":"190006900B82K2JSYWMBAJ4W","toDevice":"MIOT_r","deviceType":"vAssistant"}
    [25743] ...OK!
    [25744] Freeheap: 9464
    [32025] Got: {"deviceType":"DiyArduino","data":{"get":"state"},"fromDevice":"MIOT","toDevice":"190006900B82K2JSYWMBAJ4W"}
    [32026] data: {"get":"state"}
    [32027] fromDevice: MIOT
    [32029] form MIOT
    [32052] MIOT parse data: {"get":"state"}
    [32052] MIOT Query codes: 0
    [32052] MIOT Query All
    [32053] response to MIOT: {"temp":"20.00","humi":"20.00","pm25":"20","co2":"20"}
    [32056] isJson: {"data":{"temp":"20.00","humi":[32119] {"data":{"temp":"20.00","humi":"20.00","pm25":"20","co2":"20"},"fromDevice":"190006900B82K2JSYWMBAJ4W","toDevice":"MIOT_r","deviceType":"vAssistant"}
    [32122] ...OK!
    [32123] Freeheap: 9464

  • TA的每日心情
    郁闷
    2018-12-6 22:21
  • 签到天数: 48 天

    [LV.5]常住居民I

    发表于 2020-1-11 00:09 | 显示全部楼层
    不是bug,小爱方面湿度只接收整数,你传的浮点数。
    建议下次使用我们提供的例程测试,我们例程是无误的。
  • TA的每日心情
    开心
    2020-1-10 15:25
  • 签到天数: 1 天

    [LV.1]初来乍到

     楼主| 发表于 2020-1-11 17:09 | 显示全部楼层
    奈何col 发表于 2020-1-11 00:09
    不是bug,小爱方面湿度只接收整数,你传的浮点数。
    建议下次使用我们提供的例程测试,我们例程是无误的。
    ...

    好的,感谢回复,抱歉
    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    热门推荐

    [限时福利]5分钟带你快速了解新一代开发板:M5STACK
    [限时福利]5分钟带你快速
    一、什么是M5Stack M5Stack是一种模块化、可堆叠扩展的开发板,每个模块
    小爱同学+Blinker控制灯
    小爱同学+Blinker控制灯
    来这个社区已经很久了,有很多问题都是在这里解决的。在此谢谢他们!这里我也分享一个
    使用74hc595驱动一位数码管
    使用74hc595驱动一位数码
    74hc595是一种常用的I/O拓展芯片,今天我尝试用一个74hc595来驱动一个一位七段数码管
    74HC595的疑惑终于解开
    74HC595的疑惑终于解开
    对于74HC595的教程中和网上的资料看完还是模糊,于是一边接线测试,一边反复看图研究
    数据转换求助!!!
    数据转换求助!!!
    如何将 String str =“123,2132,1321,11”; 转换成 uint16_t A[4]= str
    Copyright   ©2015-2016  Arduino中文社区  Powered by©Discuz!   
    快速回复 返回顶部 返回列表