I guess I'd need an external If then Else

Post your questions and help other users.

Moderator: Martin

Post Reply
User avatar
husky
Posts: 132
Joined: 29 Oct 2016 13:41
Location: Omaha, Nebraska, USA
Contact:

I guess I'd need an external If then Else

Post by husky » 28 Nov 2016 07:16

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.
"Basic research is what I'm doing when I don't know what I'm doing"

User avatar
MURTUMA
Posts: 697
Joined: 05 Mar 2013 22:43

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

Post by MURTUMA » 28 Nov 2016 17:40

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.

User avatar
husky
Posts: 132
Joined: 29 Oct 2016 13:41
Location: Omaha, Nebraska, USA
Contact:

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

Post by husky » 28 Nov 2016 20:46

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
"Basic research is what I'm doing when I don't know what I'm doing"

Post Reply