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

@Savio if you structure it this way … that should work

If motion changes to active
Turn on lights
Speak
Else if motion changes to inactive
Turn off lights
End if

If you don’t mind my asking, was this a core piston that has been rewritten in webcore?

But in a scenario where a music player (Sonos in my case) was previously already playing a music source/music service - what needs to be put into the piston code to resume playback after the triggered announcement is finished?

Wait … upon closer look it appears that I just need to add “resume” after the speak text line - right?

Hi Bangali, my motion sensor unfortunately automatically turns to inactive after motion is detected with a “cool down” of 3 minutes, that is why I had to use a timer to detect if it changes again.

No sorry it’s so messy, new to webcore and I am not sure why it’s not working? It seems like its set up to work right?

Thanks!

EDIT: I may have misunderstood what you said. are you saying if you use the changes to inactive condition it turns off the lights soon after the motion active? if not, please see below. if yes, please advise and we can figure out something else.

@Savio most motion sensors have a similar cool down or blackout period. however, when it expires all motion sensors do send the inactive event. so, believe that logic should work with your motion sensor as well.

no reason to be sorry. just that the logic structure was very similar to how most core pistons were written. with webcore its often easier to use an if then … else if then … else … end if structures.

Thank you Petter. My button creates the impression that it switches if pressed in the ST App, but if used in a piston, it always returns an “off” value.
Looking in the IDE, is it not supposed to show that it has switching capabilities? Seems such a simple issue, but so far I’ve been unable to determine what the issue is. The time part works fine and I’m able to change the time the piston runs - just can’t switch it.

@Savio if motion changes to inactive turns off the light too quickly … use this

If motion changes to active
Turn on lights
Speak
Else if motion stays inactive for 3 minutes
Turn off lights
End if

hopefully one of those help.

Hi Bangali thanks for the help, unforunately tried to make it so that it would be within the motion flow so that if people used switches to turn the lights on it wouldn’t auto turn off based on motion.

I used this and it seems to work, but is there a way to “pause” a whole piston and resume it based on a timer. I can’t seem to get htat to work.

@Savio that looks nice. click on the with. on the pop-up click on the gear at the bottom of the window. then change Task Cancellation Policy to never cancel.

For the “has it not run in the last X hours” with 1w being your threshold for determining whether its run, you could do:
“IF Power Outlet’s Power Stays Less Than 1w for X hours AND weather part goes here = Rain THEN”"

As for the weather part, I haven’t dug into that but perhaps someone else can tell you how to write the piece that will be true if there’s been rain in past x hours.

Side note 1: if you have other things that drain into your sump pump, like an air conditioner or dehumidifier, then you may want to also get an alert if the sump pump hasn’t rained in more than X hours even if there hasn’t been rain.

Side note 2: I wanted to do the same thing for my sump pump, but I just am not comfortable trusting one of these power outlets for such a critical job. If the outlet was to fail for some reason, or somehow get toggled off, that would prevent the pump from running. Someone in the ST community shared that tidbit with me when I was looking to do the same. Instead I put a Multipurpose sensor on the PVC line that comes out of the pump, which wiggles when it runs and triggers the “Acceleration” condition on the sensor. Not sure if it is working properly tho or not

Im not a programmer but im guessing the switch always returns off since it may be tied to a physical switch (a z-wave switch). Since you’re making a virtual device, try this DH.

/**
 *  On/Off Alarm Tile
 */
metadata {
	definition (name: "On/Off Button Tile", namespace: "Test", author: "Test") {
		capability "Actuator"
		capability "Switch"
		capability "Sensor"
        capability "Image Capture"
        attribute "departure", "string"
	}

    preferences {
    input name: "timer", type: "time", title: "Alarm Time:", description: "Enter time", required: false
	}
	// simulator metadata
	simulator {
	}

	// UI tile definitions
	tiles {
		standardTile("button", "device.switch", width: 2, height: 2, canChangeIcon: true) {
			state "off", label: 'Off', action: "switch.on", icon: "st.switches.switch.off", backgroundColor: "#ffffff", nextState: "on"
			state "on", label: 'On', action: "switch.off", icon: "st.switches.switch.on", backgroundColor: "#00A0DC", nextState: "off"
		}
        valueTile("departure", "device.departure") {
			state "default", label:'Alarm: ${currentValue}'
		}
		main (["button", "departure"])
		details (["button", "departure"])
	}
}

def parse(String description) {
}

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 on() {
	sendEvent(name: "switch", value: "on")
}

def off() {
	sendEvent(name: "switch", value: "off")
}
1 Like

@bangali thanks for that - I will try the new IF for me and the wife arriving home together.

@mrmedia the key is to use “Speak text and resume”, not “Speak text and restore”:

sure thing.

And i updated my piston a little bit, I edited the earlier post. If you set the departure time closer then 4 hours to departure it handles the times a little better.

1 Like

Really frustrated here. Just got ST a few days ago, and I wanted to start with a relatively simple script. So I tried coding everything in plain groovy, but hit a brick wall quickly. Then I installed webCORE, and set it up here - and it works about 20% of the time.

Here is the idea: Front door has a color hue and a white hue. I wanted the door opening to trigger the white to come on full strength, and the color bulb to be a bright green. When the door is closed, the bulbs should go back to whatever their previous state was after a bit of delay.

The light will always get triggered by the door event. That’s solid.
The light will always turn bright green or bright white. Also solid.
The process to return the light to the previous condition is failing miserably.

Are Hue products just this problematic? I’m well within my return window, but, I did get a good deal on them…

Many thanks in advance to anyone that might share any wisdom!

Here’s the current pistons:

How to recover from missed Triggers

I’m guessing this piston failed today because of WebCore bug, but I was looking for help or advice on how to make this piston more reliable to able to recover from issues or missed trigger time.

Not sure if anything is going on but a piston that fires on Sunrise or Routine Execution just fired off a few mins ago seemingly by itself and tested me my battery levels…

Has Followed By and Not Followed By been implemented yet? If so how do you access it?

Piston Recovery hasn’t been implemented, yet …

Thanks Petter, this DTH works fine.
There is one hickup - I would like to change the Icon to something more appropriate than the standard Wall Plug/Outlet icon. The DTH allows one to change the icon, but every time the time is changed in settings, the icon reverts back to the original Wall Outlet icon.
Perhaps you’ll know where to look for the bug in the DTH?