Not able to add any thing to "Then" statement


#1

This isn’t my question, but I saw it on Reddit and think its a bug. A user was unable to add any statements to his “then” clause. He posted a screen shot of his piston and what it looks like to me is that the cause is that he has a two conditions, but there is no “and” or “or” statement in the condition block. I have no idea how this could have happened and I cannot replicate it.

Here is the thread. https://www.reddit.com/r/SmartThings/comments/846vrw/help_with_this_code_i_cannot_figure_out_why_i/

You’ll see the issue on line 45 of the screen shot.

Just thought it should be brought to your attention in case its a bug that could be addressed.


#2

If you import that piston, I did to see, it actually adds the and to line 45. However nested ifs, in my opinion,are nothing more than a nightmare. Try to keep the ifs at top level when possible


#3

That whole piston is a mess lol… guess that’s what happens when you source assistance from reddit!


#4

I avoid nested if’s like the plague… recipe for alcoholism :slight_smile:


#5

I hadn’t looked at the actual syntax of the piston much… it is a mess… but I’ve got a question… why are there little lightning bolts next to the “motion is active” and “time is between” statements? Doesn’t the lightning bolt indicate a trigger? And arent’t those statements conditions?


#6

They’re all conditons, not triggers. The way I understand it, in absence of triggers, conditions become the triggers.

Think Changes to Active as a trigger, not motion is active (condition)


#8

Now the challenge is to write it all in a single expression :slight_smile:


#9

I don’t see how that’s going to be possible without using else if statements. Why are those so problematic in WebCoRE?


#10

Pretty sure it’s possible, playing around with it now…
@Robin may beat me to it if he’s active right now, he’s good with zee expressions!


#11

I’ll let you handle it then. I’m a software developer by trade, but I’m still fairly green in regards to WebCoRE. I’m interested to see what you come up with.


#12

Yeah, I’m a unix admin that does more shell scripting and sysadmin work than anything, but webcore has got me playing with all sorts of stuff that I don’t normally do. It’s been fun the last 5 or so months. Keeping my brain working.


#13

Agreed. I spend way more time on home automation reddit subs than I care to admit. But I really like the problem solving aspect of it. Even if I can’t solve a problem right away, I like to try and figure it out. I’ve learned so much for myself by helping others.

If it wasn’t for the fact that my wife and I are flying into Cancun in 7 hours for our first few days without kids in a year, I’d stay up and see what I could come up with too.

Cheers!


#14

Shiiiiittt… Enjoy! Go grab some beach time… It’s essential to problem-solving… skip the water, stick with bottled beers (from experience).


#15

Bottled beers for breakfast, vodka and tonic for lunch, cabernet for dinner, tequila to put me to sleep.


#16

Lightning bolts signify an event subscription.