Gotcha. I’m posting in the device handler author’s thread now.
"Define" help needed
I’m not HUGELY confident, as the last post in that thread was in May. But, who knows…
If NOT - I suppose I can just use my Hallway light, as I rarely leave that one on, and all of my houses’ switches are zwave. I’ll give him a few days and then come back!
Let’s use a normal bulb for this exercise…
IF any of Sensor 1 or Sensor 2's contact CHANGES <-- Trigger
Then
IF any of Sensor 1 or Sensor 2's contact IS open <-- Condition
Then
Turn on Bulb (maybe Set color to red, for an alert?)
Else
Turn off Bulb
END IF
END IF
In this example, the piston runs when any contact changes (in either direction)
At that point:
- If ANY of them are open, execute the THEN block.
- If ALL of them are closed, execute the ELSE block.
So in this instance, “Else” would be used.
I swear some experience Webcore person once posted that they rarely use “Else”… I read it quite a while ago and don’t remember why they said that…
But - that does makes sense to me. The trigger (in my case) would be ANY gate changing EITHER from open to closed, or closed to opened. It would be the state of ONE of them changing. Or more than one, I suppose… Cool!!!
That was probably me.
Although that advice is actually very good…
99% of pistons can be created without using ELSE blocks.
(and they tend to confuse newbies)
When I break that “rule”, I typically only use them in very specific situations.
(1) I want to reduce triggers
(like the example above)
(2) I want to reduce code (like the example above)
(3) When there is only a single condition
attached (like the example above)
(I may occasionally break #3, but rarely)
My first SmartHome (X10) only had about 30 devices back in 2000…
… but I have used many ecosystems since then.
My best creations always seem to be about 10-15 years ahead of the rest of the world… LOL
For example, me & my early clients have had talking SmartHomes since 2002…
- 12 years before Alexa was born
- 16 years before SmartThings could talk
- 17 years before Echo Speaks was released
- 18 years before Echo Speaks was removed
Oh wow, I remember X10!! Heh, I’m impressed and grateful to you for sharing your knowledge so freely and good-natured!
And here we go! He replied and said:
The reason your piston isn’t working is that the device hasn’t reported that it’s on yet so WebCoRE’s thinks it’s already off and it’s ignoring the off command.
CoRE had an option called something like “disable optimization” which disabled that check and made it always execute the command. WebCoRE must have something similar and disabling it should solve your problem.
Ahh yes… If his DH cannot report back to the hub in 4 sec, we can force the second command to be sent anyways.
Here are the steps:
- Edit the test piston (turn on, wait 4 sec, turn off)
- Click on the title on line 2
- Click the cog-wheel
- Then disable “Command Optimizations”
Once saved, this option will only affect this one piston.
Normally, if a device is off, webCoRE is smart enough to not send another “Turn off” command.
With this disabled, it will send the command, regardless of the current status.
Lookin’ good!
It is not visible in the snapshot, but I just want to confirm that
- Line 26 should be ANY {Gates}
- Line 29 should be ANY {Gates}
If the two above are correct, then line 38 becomes pointless, consuming unnecessary processing power.
In other words, the Else block can simply be this:
Else
With Music player, turn off
END IF
Question:
Have you ever been able to use webCoRE to STOP the flashing yet?
(If not, I would focus on the test piston (with disabled command optimization) before walking outside to do the gate test)
Oh NEAT! Ok, that makes sense.
Oh yeah, the “disable command optimization” did the trick!
I’ve been able to test it a few times and it works well. The strobe/siren, apparently, isn’t the most RELIABLE device (per user reviews) but layers of security (dog security, that is!) are good. I’m probably going to add a “notify” in this, using my Google devices, and/or push notifications. Layers!
Layers are good, if you can keep them from stepping on each other’s toes, LOL
Now I guess the challenge for you is trying to decide which post to as the solution…
SO!!! I’ve had this running for a few days, the flasher doesn’t turn off. BUT… I realized I forgot to change my “else” statement, so I did. We’ll see how that works…
ASIDE from that - I want to add to this. I want an SMS to tell me WHICH gate opened!!! I do know how to do the SMS part, but I’m not at all sure about the rest, short of creating another piston.
I believe you used the wrong ELSE block. I think you want the “Turn off” to be:
IF any Gate contact changes
Then
IF any Gate contact is open
Then
Turn on
ELSE
Turn off
END IF
END IF
I will answer your second question after I finish eating…
I am thinking something like this:
(notice we are using the ELSE attached to the condition
, not the trigger
)