Simple Fryer Piston not resolving properly


#1

I’m new to webcore and fairly new to any type of programming so forgive me if this is too basic.
I made what I thought would be a really simple piston, but its not working at all.

1) Give a description of the problem
Not really sure. But its not working. Its monitoring my fryer and so when it reaches the right temperature it goes to 0W power. I see it going to that while monitoring it.

2) What is the expected behavior?
After it goes to 0W I should be getting notified

3) What is happening/not happening?
No notifications. Its basically if one person is home it sends the message to them, if the other person is also home then it goes to them (which is true now as both are home)

**4) Post a Green Snapshot of the piston:

5) Attach any logs (From ST IDE and by turning logging level to Full)
EDIT: This is from the IDE live logging, if thats what this means:

12:56:56 AM: debug ║ Duration 89522ms for is >= 20000ms threshold = true
12:55:32 AM: debug ║ Duration 5625ms for is >= 20000ms threshold = false

PS: I’d also like it to suspend the piston at the end (so multiple notifications don’t happen), but I figured I would test to make sure I could get the basic functionality of it working first.


#2

If presence sensor 2 was present your if condition will not pass and nothing will happen. Line 27 and 29 need to be true for the messages to be sent.

Try clicking on the word and on line 28 and change that to ‘or’.

That way either person can be home and it will pass and send messages

Also from your logs the 12:55 duration fired and the fryer was only on for almost 6 seconds thus false
The second duration was almost 90 seconds so true.

Sorry don’t have a power reporting switch that I can test for you.


#3

I know its not clear from the picture but the SMS would go to two different people depending on who is home.

Line 27 to 29 I wanted to make a condition if one person is home AND not the other. If I switch that to OR then wouldn’t it just always go to the first person as long as they are home?

I thought the else if would kick in if that condition was false and send the SMS to the other person instead if they are home.


#4

Ok, I think this is what you are looking for. Your going to have to adapt to what you need. I don’t have a power meter so I used a motion that reports temp for that. Also for the outlet 1 switch I used one of my switches. The log to console was just for testing. Replace that with your sms notifications and email stuff

But this should help I think.


#5

Am I just not understanding the else if condition properly?

I thought that if the first part was false ie: presence 1 is NOT there OR presence 2 IS there that it would go to the else if statement.


#6

It should. However I try to limit the amount of nested ifs as much as possible… things seem to work better when the if blocks are top level