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

Do you mean being able to drag and drop statements so that you can re-order the statements?
If so, you can do this already.

not statements, variables defined in the define block. thank you.

EDIT: also, global variables use random ordering all over the place. a sorted list would be much simpler for locating these variables, whether in drop down lists or in the EDIT UI and other places.

i have been modifying a piston someone had posted for battery check and notification. this line at line 32 gives an easy way to find what the minimum battery level is for my battery powered devices. any recommendation for the simplest way to find what the corresponding device name is for this minimum battery level that the min() statement returns?


This is what I use. Runs once a week which I find adequate.

1 Like

@bobbles thank you. added a if check with save matching devices to get the list. this piston i am using is a little more extensive in that it also save the battery percentages as a string and i have added different handling/messaging for critical and low battery levels.

also, currently playing with some xiaomi devices, a couple of which seem to be draining batteries like crazy so the string list comes in handy to compare hourly snapshots of the string.

thanks for suggesting the matching / non-matching statement.

Should work now, in the DH, change:

def updated() {
	def time = timer.substring(11,16)
	if(timer) {
    		log.debug "Departure time set to: $timer"
    		sendEvent("name":"image", "value":timer)
            sendEvent("name":"departure", "value":time)
    } else {
    		log.debug "No departure time is set"


def updated() {
        def time = timer.substring(11,16)
        def tz = location.timeZone
        def schedTime = timeToday(timer, tz)

    if(timer) {
    		log.debug "Departure time set to: $timer"
    		sendEvent("name":"image", "value":schedTime)
            sendEvent("name":"departure", "value":time)
    } else {
    		log.debug "No departure time is set"

And in the piston, change:

Can anyone help me explain why my motion inactive events are not updating the variables in the “on events from” on line 54? I’ve turned on logging and the event is being shown in the log but the variables for motion is always “motion”

Hey guys,

Having some problems with this piston. It is a motion sensor meant to flash lights a color if someone is at the front door. It works well but when it resets the lights sometimes after the “flash” sequence it sometimes turns the light red for some reason. Also, I thought if the light was off it will return to it’s “off” state when it’s done? Here it is staying on. Am I doing something wrong with capturing the light states prior to the flash and restoring it after? Thanks!

I’ve been trying to use webCore and Yves’ Ecobee device to set the climate to away indefinite but for the life of me can’t get the holdType to pass through. I have the standard parameter set to nextTransition so when I use Home/Alexa to set the temp it is temporary, but when I leave the house I want it to set indefinite. I realized my programs are kicking off before I come home even though it could be hours, or days, till I return. I think its something I am doing wrong with entering the parameters. If I enter the first parameter as “”, second as Away, it works and uses the default hold. If I set the third to be [holdType:‘indefinite’] it does nothing. Suggestions?

I’m trying to get the following piston working. In summary, I’m trying to replace the auto-lock functionality on our Schlage locks with something a little more customized. In particular, I want: 1) a simpler way to temporarily disable the auto-lock than needing to open the door, lock the lock, enter a user code, and then quickly re-lock and unlock again, and 2) locks not to auto-lock while the door is still open (I’m taking out the garbage, please don’t extend the deadbolt so I wham it into the door jamb when I come back), OR while it is closed without having been opened (I’m expecting the neighbor to come by so I’ve unlocked the lock from the inside).

The piston mostly works. I can (usually) temporarily disable auto-lock simply by unlocking via the knob twice within 5 seconds, and it won’t lock until the door has been opened and closed. The problem is in that “usually” – I find if I unlock/lock/unlock too quickly (say, within 1-2 seconds), the final ‘unlock’ is not registered as a state change. If I turn on full debugging, I see the first ‘unlock’ and the ‘lock’ are seen as changes, but the second ‘unlock’ is not viewed as a change, and the code to disable auto-lock is not run.

Is there just a basic limitation where events that come too quickly might result in state changes not being interpreted? Or do I need to change how I’m handling these events?

Note that I’m using the fancy new typed list feature in order to write this code once and have it work for multiple door/lock combinations – I’ve tried simplifying and I can’t definitively say yet that the behavior I’m seeing is specific to one or the other implementation. I only have two exterior doors, so I know I could just duplicate the code twice, but I thought I’d try to be fancy and write it once to work with both… bad idea? Am I missing a simpler way to only code it once? (The thing that makes it a little complicated is needing to act on different door/lock combinations rather than running the same code for all unlocked/locked/closed events.)

I’d just also like to add that I think webCoRE is absolutely amazing! I write software for my day job and I recognize what a huge undertaking this project is, and how polished it is. I’m really looking forward to learning how to use it to its full potential.

EDIT: I think one of the contacts is showing up as ‘Water Sensor 1’ because it’s a test device using uDTH so I can test the piston from the comfort of my sofa. I don’t think that’s related to my issue, because I can reproduce it with the physical door and lock.

Thank you, Petter, that did the trick!

(The icon still changes back to the original default whenever one goes into the Settings, but I’ll take a look at the links you provided earlier to see if I can sort that part out.)

I’m creating a piston to function as a fancy “Wake-Up Alarm”. I got the idea from a piston @Arnqvist created to heat his vehicle. The execution time is set with a Virtual Device Handler @Arnqvist created.
Here is what I’ve managed to do so far: The “Alarm” (Piston) is turned on with the Virtual Device and runs at the time set in the Virtual Device Settings. The piston uses the alarm time to calculate when to turn on devices like heaters, water heaters etc. It warns me it the “Alarm” is turned on when I’m not at home, and likewise warns me if I’m at home, but the Alarm is not turned on (if the next day is a weekday).

Example of Piston State:

I’ll appreciate it if the more experienced could comment on any design flaws or where I could improve on the design.
Also, I would like to know:
Is there an easier way to indicate if a (Virtual) Device is turned on/off in the Piston State (I currently set text (ON/OFF) as the contents of a variable to accomplish this, but I can imagine that it could easily happen that the contents of the text
and the actual switch state, could go out of sync.
If a device is not turned on due to a condition being false, is it possible to report in the piston state why the device was not turned on? (i.e. which condition was false). It would e.g. be nice to indicate in the piston-state something like “Did not turn Heater on as outside temperature is above threshold”. (I suppose that will go in the “else” part of the statement if this is possible).
I get the piston execution time from a variable “WhenDidItHappen” (I do this from an example I got on the forum). Will this Variable be updated each time a statement is executed?
Currently, my piston state shows if the alarm is ON/OFF and always display the time for which the alarm has been set (regardless of whether it’ been turned Off). Is conditional formating possible in respect of the Piston State and if so, how would I only display the time for which the alarm is set if the Alarm is turned On?
Thanks guys

Try adding a Wait of a second or two between capture and flash.

Trying to write a piston to operate on any of a set of similar devices (GE Smart Motion Dimmers). What I’m trying to do is “if a switch is physically turned on, set operatingMode to Occupancy; if physically turned off, set operatingMode to Vacancy.” I like that webCoRE exposes the distinction between the switch being physically interacted with versus programmatic/automatic changes. (Though I hope the switch turning itself off registers appropriately – haven’t checked.)

When I pick a single device, I can access the operatingMode (which is exposed by the DTH). However, if I trigger on a set of devices and store the active device into a variable, it doesn’t expose the option to change that (presumably because a device variable could be anything). Is it possible to get an appropriately-typed instance of the single switch that had interaction without having a separate instance (or separate if statement) for each switch to which I want to apply this behavior?

I have a piston that controls my kitchen light throughout the day.
Two are on a AM and PM Schedule.
One is late night motion trigger
One is a straight forward 10 minute timer
The last one is when the light is on manual in between the other point in time.

I make use of a Global Variable that is supposed to control activities when an event is triggered.

I am have problems getting this to run consistantly. Like why is there a 5:30 AM event when the first scheduled event is at 6:45 AM. Then the timer link to motion inactive and my time seems to always counting down. Especially after I gone into the piston then save.

Got it working with ((event2-event1/1000)) to come back with the # of seconds that had passed. thanks!

@949BFN for the if checks at line 79 & 109 the conditions include a temperature check. but at line 95, even though the remaining conditions are similar does not include the temperature. is that intentional?

in the set piston state you could do something like this to only show alarm when ON … typed from memory …

(upper([inputSwitch : state]) == ‘ON’ ? “Alarm is [red|ON] (Set for [black|{alarmTime}])” : “”)

Any more info as to why webcore dashboard won’t work on Android Chrome?

@MikeBishop if you post a snapshot of the piston, makes it easier for folks to understand the question in context and respond.


@DarcRanger where are you seeing this 5:30am event?