I had a quick look at your actions and yes, you could have a big potential issue ! :-)
This would be what I call a "negative cascading effect" and theoretically you could start receiving 6 notifications every 10 seconds if the temperature drops to less than 2Cº
The issue is that you are probably looking at the actions as a
Doesn't work like thisIf ( action 1 == true) {
do something
return
}else if (action 2 == true ){
do something
return
}else if( action 3 == true){
do something
return
}
It's like thisEach action is an independent IF statement
if(action 1 == true ){
do something
}
if(action 2 == true ){
do something
}
if(action 3 == true ){
do something
}
So, your actions are
Temp < 2C >> send notification
Temp < 3C >> send notification
Temp < 4C >> send notification
Temp < 5C >> send notification
Temp < 6C >> send notification
Temp < 8C >> send notification
That means that if the Temp < 2 all actions will be true and execute one after another (or if Temp is < 6 then last two would execute etc...)
The question is how to get this logic to work???
Well, one option is with the new Dev Console Actions you can now add an "AND" so you can do something like this:
IF Device 1 > Indoor Temperature < 3
AND Device 1 > Indoor Temperature > 2
...
IF Device 1 > Indoor Temperature < 8
AND Device 1 > Indoor Temperature > 6
(I've changed this one so you can have a look)I think would solve the cascade effect so each Action is encapsulating the temperature range of interest.
The problem that will still exist is that you would still get a notification every 10 seconds as the device sends its heartbeat whilst the temperature is in less than 8C range
so you need something to block the notifications for some time and that's going to be a pain in the ass to achieve elegantly !
I think the way I would handle it is by having just one action and adding one extra component to the device:
1. add an extra component called "alertblock" - type number (or something like that)
You need two actions:
2.
Action 1 (you need two rules that will execute)
IF Device > Indoor Temp < 8 AND alertblock == 0
Rule 1: send notification "Temperature Low >>>" (tick "Send component status")
You should receive a notification something like "Temperature low >> 3.2" (or whatever the sensor reading is)
Rule 2: Device >> Entire Device >> As Text >> "alertblock_1"
(Currently you can't target a component on the same device that is also a trigger so we have to send it like this)
3.
Action 2 - this will tell the device to reset the alert block if the temperature goes over 8C
IF Device > Indoor Temp > 8 AND alertblock == 1
Rule: Device >> Entire Device >> As Text >> "alertblock_0"
4. in the device code
bool alertblock = 0;
unsigned long reset_alertblock_timer = 0;
void ChipChop_onCommandReceived(String &component,String &value, String &source, int command_age){
if(component == "any"){
if(value == "alertblock_0"){
alertblock = 0;
ChipChop.updateStatus("alertblock", 0);
reset_alertblock_timer = millis();
}else if(value == "alertblock_1"){
alertblock = 1;
ChipChop.updateStatus("alertblock", 1);
}
}
}
void setup(){
......
ChipChop.updateStatus("alertblock", alertblock);
}
void loop(){
.....
// this is optional, it would allow new notifications after 30 mins if the temperature is still low
if(alertblock == 1){
if(millis() - reset_alertblock_timer > 1800000){ //30 minutes
alertblock = 0;
ChipChop.updateStatus("alertblock", alertblock);
}
}
}
This is just a quick and dirty example, let me know what you think