Page 1 of 1

I guess I'd need an external If then Else

Posted: 28 Nov 2016 07:16
by husky
The algorithm:
1. Trigger- Periodic time
2. Condition- Battery Level set to "lower than 0" just to get hold of the battery_temperature
3.Script-
global_temp_max= 36; // for test purposes ovetheat set to 36 degrees
global_temp={battery_temperature};
global_temp=global_temp / 10;
4.Speech
current temp is {global_temp};
Temperature threshold {global_temp_max};

5. What I'm trying to achieve:
Speech Output and Notification in the format:
Current temperature when below threshold;
Warning when global_temp >= global_temp_max

6. Where I'm stuck
Using conventional wisdom, IMHO, I'd need a Condition ( IF then Else type)
such as:

if (global_temp >= global_temp_max)
{ send warning speeech and notification about possible overheating
}
else
{
send only the current temperature without warning
}
7. Question:
Is there a way to insert in the flow a "box" where I run the If statement?

8. Observation
Since I'm giving my first steps wit AutoMagic, I fail to see how I
could create a "user condition box" in the flow
since the only possible ones are "Action and Condition"
using the pre-built options.

Re: I guess I'd need an external If then Else

Posted: 28 Nov 2016 17:40
by MURTUMA
Condition Expression is your friend here. You can write any expression to it to suit your purposes.

For example:
"global_temp >= global_temp_max"
If temp is higher than temp_max, the condition evaluated to true. Otherwise to false.

Re: I guess I'd need an external If then Else

Posted: 28 Nov 2016 20:46
by husky
Hello MURTUMA,

Thank You for the reply.

The EXPRESSION really made my day. It was the IF/Else I was looking for.

The program was finished with the expected and correct results.


Regards