背景:

我正在研究温度监控项目Obniz微控制器。目的是在温度超过所选阈值时发出通知。

我搜索了很多有关创建触发器的内容,以便ifttt可以读取我的触发器,但是找不到适合我的温度监控项目的理想方法。

这是我要触发的js代码:

var t = document.getElementById("tThresh");
var tempThresh = t.options[t.selectedIndex].value;
if (obj.temperature > tempThresh){
    led1.on()
    obniz.display.print("The temperature is too high")
    obniz.display.clear();
};


谁能帮我?

最佳答案

如果不是,则为什么不设置setTimeout,每隔1-5分钟查找一次最新的温度和决定因素,如果最新温度高于限制,则执行此操作。
例:

var limit = 60;
var current = 30;
setTimeout(function(){
   if(current >= limit){
      window.alert("Temperature is being a litle bit high.");
   }
}, 3000);

关于javascript - 从html到ifttt进行触发,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/53056695/

10-14 13:59
查看更多