【问题】:洁净车间的温湿度点检时,受点检次数影响,无法整体把握车间温湿度变化情况,出现异常时,没有及时提醒;
【对策】:使用ES8266开发版定期采集数据上传简道云,出现异常时推送预警给担当人处理
【准备】:
1、ES8266开发版、OLED液晶屏、DHT11(或DHT22)传感器
2、Arduino软件
DHT11传感器,精度偏差2度;DHT22,精度偏差为0.5度
【要点】:
连接简道云是https连接,要用#include 而不是#include ;
const char fingerprint[] PROGMEM = "52 F8 46 9D 9F 84 7E 1A 3A 12 31 07 52 B3 83 34 41 E7 36 66";
//JDY
String appId ="**************";
String entryId ="****************";
String host = "api.jiandaoyun.com";
String url= "/api/v3/app/" + appId + "/entry/" + entryId + "/data_create";
//Serial.println(url);
String payload = "{\"data\": {\"_widget_1629791681381\": {\"value\": \"手表\"},\"_widget_1600992818676\": {\"value\": \"组装车间\"},\"_widget_1600992819176\": {\"value\": " + String(t,1) + "}," + "\"_widget_1600992819211\":{\"value\": " + String(h,1) + "}" + "},\"is_start_trigger\": true}";
//Serial.println(payload);
WiFiClientSecure client;
client.setFingerprint(fingerprint);
if (!client.connect(host, 443)) {
Serial.println("Connection to server failed!");
return;
}
client.println(String("POST ") + url + " HTTP/1.1");
client.println("Host: " + host);
client.println("Content-Type: application/json");
client.println("Authorization: Bearer *****************************");//API-KEY
client.println("Content-Length: " + String(payload.length()));
client.println("");
client.println(payload);
client.println("");
client.println("Connection: close");
【效果】:
编辑于 2021-10-20 11:04
|