[DEPRECATED Thread: visit community.webcore.co for assistance] webCoRE - Piston Design Help (ask your fellow members for assistance)

2 Likes

Many thanks, @Nezmo!

I am not at all certain why that failed to show up in my search for “weather.”

1 Like

Thanks for the help, but that procedure Will just turn off the device after 5 minutes… is there a way that the following can happen. If a light switch is turned on, then off, then on…within let’s say 5 seconds, the. The light will stay on indefinitely… but if the switch is simply turned on , it will turn off in 5 minutes… , Basically turning the switch on, off , on quickly overrides the auto turn off feature… any help would be greatly appreciated…thanks…

1 Like

Set an integer variable to count switch ON states.
Set a boolean variable like booManualSwitch=true on the following.

IF intSwitchOnCount > 1
THEN
Set booManualSwitch=true

Test for true on the boolean variable in the conditions that determine how long your light stays on.
Reset the boolean variable to false at the appropriate point in the code.

My Piston is working great, EXCEPT, if there no devices to put into “OpenWindows” or “OpenDoors” then in the SMS notification I get ‘empty device list’ as the text. I was expecting the device list to be ‘null’ if empty. How can I clean up my SMS message if either device list is empty?

Has the way currentDeviceIndex is set for buttons changed? The following used to work for me but recently (maybe a few weeks?) stopped working. Looking into it, the issue seems to be the currentEventDeviceIndex has changed… it used to be 1 when button #1 was pushed and is now 49. When button 2 is pushed it’ s 50 instead of 2, button 3 is 51, etc…

Screenshot below – line 24-45 is working fine. The issue is with line 46+

i have simple piston to text me when hem v1 laundry smartapp pushes virtual button. sometimes the smart app is sending 5 quick button presses causing 5 texts. is there feature in webcore to prevent this piston from running multiple times within X minutes? or should i just store the last execution time to variable and compare in the if?

execute
if
HEMWasherDryer's button #1 gets pushed
then
 Send SMS notification "Laundry Washer Done" to 555-1212;
end if

@bangali I finally got the SHM Manager piston working as expected. Thanks for your input (I went through it line by line:

1 Like

Thanks, I modified it to report both doors and windows and it’s great! Thanks.

Love the way you did the Temperature Gauges. Can you please share the code for that?

Sure. I based mine on one of @ady624’s pistons so he should get the credit. I just expanded it a little today to give a separate gauge for upstairs and downstairs temps and humidity.

1 Like

@Townsmcp that’s awesome. good to hear it’s working for you.

you could add another if check to the condition previousAge([device : button]) > 5000 (or another suitable value in milliseconds) so if the button is pushed within X (=5 here) seconds of the last push it will not trigger the SMS.

Is there an expression/way to find out $currentEventDevice is in a predefined variable which contains list of devices?

yes. use indexOf(devices, $currentEventDevice). returns -1 if not found.

Is there a list of functions/expressions as the one you show here - indexOf()?

yes. please see here:

https://wiki.webcore.co/Functions

EDIT: since webcore is in beta and actively being developed by @ady624, that wiki may not always have the latest updates to functions. so, please dont hesitate to ask here and i am sure some one from the community will jump in with the right answer. :slight_smile:

1 Like

Thank you very much!!

you are very welcome.

Yoo hooooooo goes Hulk the Universal ride. Gotta admit, writing webCoRE, easy, kid’s birthday, not so much lol - drove for 6 hours today, walked all over St. Augustine, FL today, then drove to Orlando, FL, checked into hotel, WALKED to Universal Studios, did couple of rides, drink, walk back to hotel, drink more, write nonsensical post on ST forum, I am telling you, hard stuff…

9 Likes