Fucher
发表于 2020-8-2 21:11
问题现象:一直复位
android版本:9
手机型号:OPPO A51
库版本: v0.3.4
开发板:esp8266 NodeMCU1.0
LOG信息:
```
ets Jan8 2013,rst cause:2, boot mode:(3,7)
load 0x4010f000, len 3664, room 16
tail 0
chksum 0xee
csum 0xee
v39c79d9b
~ld
__ __ __
/\ \ /\ \ __ /\ \ v0.3.4
\ \ \___ \ \ \/\_\ ___\ \ \/'\ __ _ __
\ \ '__`\\ \ \ \/\ \ /' _ `\ \ , < /'__`\/\`'__\
\ \ \L\ \\ \ \_\ \ \/\ \/\ \ \ \\`\ /\__/\ \ \./
\ \_,__/ \ \__\\ \_\ \_\ \_\ \_\ \_\ \____\\ \_\
\/___/ \/__/ \/_/\/_/\/_/\/_/\/_/\/____/ \/_/
To better use blinker with your IoT project!
Download latest blinker library here!
=> https://github.com/blinker-iot/blinker-library
Connecting to TP-LINK_2A38
ESP8266_MQTT initialized...
===========================================================
================== Blinker Timer loaded! ==================
Warning!EEPROM address 1536-2431 is used for Blinker Timer!
============= DON'T USE THESE EEPROM ADDRESS! =============
===========================================================
--------------- CUT HERE FOR EXCEPTION DECODER ---------------
Soft WDT reset
>>>stack>>>
ctx: cont
sp: 3ffffde0 end: 3fffffc0 offset: 01a0
3fffff80:3fffdad0 3ffef950 00000000 402103ed
3fffff90:80006e00 feefeffe 80efeffe feefeffe
3fffffa0:3fffdad0 00000000 3fff0b1c 40228374
3fffffb0:feefeffe feefeffe 3ffe85cc 40101181
<<<stack<<<
--------------- CUT HERE FOR EXCEPTION DECODER ---------------
```
```
#define BLINKER_PRINT Serial //用于打开串口
#define BLINKER_WIFI
#define BLINKER_MIOT_LIGHT
#include <Blinker.h>
#include <Arduino.h>
#include <IRremoteESP8266.h>
#include <IRrecv.h>
#include <IRutils.h>
#define Key 5 //-----------D1
//红外遥控
const uint16_t RecvPin = 4; //定义4号引脚(D2)为信号接受脚
IRrecv myrecv(RecvPin); //创建一个信号接收对象myrecv
decode_results results; //收到后外信号解码后的值
char auth[] = "5121bddd997e";
char ssid[] = "TP-LINK_2A38";
char pswd[] = "13854359579";
int colorW;
unsigned char led_power;
u8_t wsMode;
BlinkerButton Button1("Key"); //app新建组件 Key
// app 端按下按键即会执行该函数 回调函数
void button1_callback(const String & state) {
BLINKER_LOG("get button state: ", state);
if (state=="on") {
digitalWrite(LED_BUILTIN, LOW);
// 反馈开关状态
Button1.print("on");
} else if(state=="off"){
digitalWrite(LED_BUILTIN, HIGH);
// 反馈开关状态
Button1.print("off");
}
}
//用户自定义电源类操作的回调函数: 小米小爱
void miotPowerState(const String & state)
{
BLINKER_LOG("need set power state: ", state);
if (state == BLINKER_CMD_ON) {
digitalWrite(LED_BUILTIN, LOW);
led_power = 1;
Button1.print("on");
BlinkerMIOT.powerState("on");
BlinkerMIOT.print();
}
else if (state == BLINKER_CMD_OFF) {
digitalWrite(LED_BUILTIN, HIGH);
led_power = 0;
Button1.print("off");
BlinkerMIOT.powerState("off");
BlinkerMIOT.print();
}
}
//用户自定义亮度控制的回调函数:小爱同学 灯的亮度控制函数 亮度范围为1-100
void miotBright(const String & bright)
{
BLINKER_LOG("need set brightness: ", bright);
colorW = bright.toInt();
analogWrite(LED_BUILTIN,100 - colorW);
BLINKER_LOG("now set brightness: ", colorW);
BlinkerMIOT.brightness(colorW);
BlinkerMIOT.print();
}
//用户自定义设备查询的回调函数:
void miotQuery(int32_t queryCode)
{
BLINKER_LOG("MIOT Query codes: ", queryCode);
switch (queryCode)
{
case 0: //查询所有设备的情况
BLINKER_LOG("MIOT Query brightness: ", colorW);
BlinkerMIOT.brightness(colorW); //反馈灯的亮度
BlinkerMIOT.powerState(led_power ?"on":"off");//反馈灯的亮灭
BlinkerMIOT.print(); //反馈至小爱
break;
case BLINKER_CMD_QUERY_PM25_NUMBER : /* 下面的这些用不到,供参考*/
BLINKER_LOG("MIOT Query PM25");
BlinkerMIOT.pm25(20);
BlinkerMIOT.print();
break;
case BLINKER_CMD_QUERY_HUMI_NUMBER :
BLINKER_LOG("MIOT Query HUMI");
BlinkerMIOT.humi(20);
BlinkerMIOT.print();
break;
case BLINKER_CMD_QUERY_TEMP_NUMBER :
BLINKER_LOG("MIOT Query TEMP");
BlinkerMIOT.temp(20);
BlinkerMIOT.print();
break;
case BLINKER_CMD_QUERY_TIME_NUMBER :
BLINKER_LOG("MIOT Query Time");
//BlinkerMIOT.time(millis());
BlinkerMIOT.print();
break;
default :
BlinkerMIOT.temp(20);
BlinkerMIOT.humi(20);
BlinkerMIOT.pm25(20);
BlinkerMIOT.co2(20);
BlinkerMIOT.print();
break;
}
}
//用户自定义模式设置的回调函数:
void miotMode(uint8_t mode)
{
BLINKER_LOG("need set mode: ", mode);
if (mode == BLINKER_CMD_MIOT_DAY) {
// Your mode function
}
else if (mode == BLINKER_CMD_MIOT_NIGHT) {
// Your mode function
}
else if (mode == BLINKER_CMD_MIOT_COLOR) {
// Your mode function
}
else if (mode == BLINKER_CMD_MIOT_WARMTH) {
// Your mode function
}
else if (mode == BLINKER_CMD_MIOT_TV) {
// Your mode function
}
else if (mode == BLINKER_CMD_MIOT_READING) {
// Your mode function
analogWrite(LED_BUILTIN,100-80);
}
else if (mode == BLINKER_CMD_MIOT_COMPUTER) {
// Your mode function
analogWrite(LED_BUILTIN,100-50);
}
wsMode = mode;
BlinkerMIOT.mode(mode);
BlinkerMIOT.print();
}
void setup()
{
//开启串口
Serial.begin(115200);
BLINKER_DEBUG.stream(Serial); //串口打印调试信息
Blinker.begin(auth, ssid, pswd);
//初始化LED引脚
pinMode(LED_BUILTIN,OUTPUT);
digitalWrite(LED_BUILTIN,HIGH);
//独立按键
pinMode(Key,INPUT);
digitalWrite(Key,HIGH);
//设置灯的亮度调节范围
analogWriteRange(100);
//注册回调函数 电源类回调函数
BlinkerMIOT.attachPowerState(miotPowerState);
//注册回调函数: 用户自定义设备查询
BlinkerMIOT.attachQuery(miotQuery);
//注册回调函数 亮度回调函数
BlinkerMIOT.attachBrightness(miotBright);
//注册回调函数 模式回调函数
BlinkerMIOT.attachMode(miotMode);
//注册回调函数 按键回调
Button1.attach(button1_callback);
//红外初始化
myrecv.enableIRIn();// 启用红外接收
}
void loop()
{
Blinker.run();/*每次运行都会将设备收到的数据进行一次解析。
//在使用WiFi接入时,该语句也负责保持网络连接*/
if(wsMode==BLINKER_CMD_MIOT_NIGHT)
{
for (uint i = 0; i < 100; i++)
{
analogWrite(LED_BUILTIN,100-i);
Blinker.delay(10);
}
for (uint i = 99; i > 0; i--)
{
analogWrite(LED_BUILTIN,100-i);
Blinker.delay(10);
}
}
if(digitalRead(Key)==LOW)
{
delay(20);
digitalWrite(LED_BUILTIN,LOW);
led_power = 0;
Button1.print("on");
while(digitalRead(Key)==LOW);
Serial.print("LOW!");
}
if (myrecv.decode(&results)) // 接受到信号并解码
{
serialPrintUint64(results.value);//串口显示收到的信号值
Serial.println(" ");//换行
if (results.value==16724175)
{
digitalWrite(LED_BUILTIN,!digitalRead(LED_BUILTIN));//实现按下亮再按灭
}
myrecv.resume();//刷新
}
delay(100);
}
```
奈何col
发表于 2020-8-2 22:16
Fucher 发表于 2020-8-2 21:11
问题现象:一直复位
android版本:9
手机型号:OPPO A51
应该是您使用的其他lib造成
请测试例程,如果例程没问题,就不是blinker lib上的问题
Fucher
发表于 2020-8-2 23:02
奈何col 发表于 2020-8-2 22:16
应该是您使用的其他lib造成
请测试例程,如果例程没问题,就不是blinker lib上的问题 ...
好的,谢谢
跋扈
发表于 2020-8-13 22:06
小爱同学控制灯,无法成功,小爱同学显示操作完成,但是灯没有反应,用其他方式都可正常控制灯
奈何col
发表于 2020-8-13 22:10
跋扈 发表于 2020-8-13 22:06
小爱同学控制灯,无法成功,小爱同学显示操作完成,但是灯没有反应,用其他方式都可正常控制灯 ...
这个只有你自己检查了,控制IO的程序是你自己写的,blinker只是负责接收和解析指令
heijihys
发表于 2020-9-28 00:16
问题:共享后子设备无法控制,主设备正常
使用树莓派+python Wifi接入
主设备控制一切正常,子设备无法控制,也无法与设备进行通信。显示离线,点进设备状态会在离线和已连接之间变
app皆为2.4.7版本,手机是小米10Pro和小米CC9,系统都是MIUI12稳定版。交换主从关系或者试用IOS app都有同样的现象,只要是子设备就无法控制、通信。
奈何col
发表于 2020-9-28 09:01
heijihys 发表于 2020-9-28 00:16
问题:共享后子设备无法控制,主设备正常
使用树莓派+python Wifi接入
主设备控制一切正常,子设备无法控制 ...
试试开发中的版本呢 https://github.com/blinker-iot/blinker-py/tree/dev_2.0
如果还是不行,请回复告知我们,我们近期修复
twitter
发表于 2020-9-28 09:38
问题现象:Blinker在树莓派上正常运行几分钟就报错退出
开发板:树莓派3B+
其他说明:树莓派3B+ ,python3 。Blinker代码可正常运行几分钟,与APP通信也正常,但几分钟后就报错如下:
File "Blink.py", line 52, in
Blinker.run()
File "/usr/local/lib/python3.7/dist-packages/Blinker-0.2.0-py3.7.egg/Blinker/Blinker.py", line 247, in run
BlinkerPY.checkAutoFormat(self)
File "/usr/local/lib/python3.7/dist-packages/Blinker-0.2.0-py3.7.egg/Blinker/Blinker.py", line 357, in checkAutoFormat
BLINKER_LOG_ALL("auto format: ", json.loads(bProto.sendBuf))
File "/usr/lib/python3.7/json/init.py", line 348, in loads
return _default_decoder.decode(s)
File "/usr/lib/python3.7/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python3.7/json/decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
奈何col
发表于 2020-9-28 09:54
twitter 发表于 2020-9-28 09:38
问题现象:Blinker在树莓派上正常运行几分钟就报错退出
开发板:树莓派3B+
其他说明:树莓派3B+ ,python3...
试试开发中的版本呢 https://github.com/blinker-iot/blinker-py/tree/dev_2.0
如果还是不行,请回复告知我们,我们近期修复
twitter
发表于 2020-9-28 11:49
奈何col 发表于 2020-9-28 09:54
试试开发中的版本呢 https://github.com/blinker-iot/blinker-py/tree/dev_2.0
如果还是不行,请回复告知 ...
仍有报错信息:
Traceback (most recent call last):
File "Blink.py", line 9, in <module>
Blinker.mode("BLINKER_WIFI")
File "/usr/local/lib/python3.7/dist-packages/Blinker-0.2.0-py3.7.egg/Blinker/Blinker.py", line 122, in mode
bProto.conn1 = bProto.proto1.MQTTClient()
AttributeError: type object 'BlinkerMQTT' has no attribute 'MQTTClient'