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

I like that. I forgot about Adrian’s suggestion before, save ST another timer! :smiley:

Can’t seem to find $lastday in the variables list. Do I have to create it

My piston was imported from someone’s webcore. I can’t remember who exactly

Thanks to all that replied. Please forgive my remedial questions. This all new to me. Seeing examples makes it much easier for me to understand how the different components work. This was my 1st piston using a variable and it worked. Another step forward.

Is there a place to share and see users pistons

It was my first piston using a variable as well.

1 Like

check this thread

and the wiki

Great thanks! I did read through the Wiki. Hopefully I’ll learn enough to come up with something worth posting soon. My only other webCoRE piston is a thermostat for a ceiling fan that adjust speed with temp changes. Pretty simple, but I felt good when it ran and worked. I’d really like to come up with something that will speak a random response from a list of preset or variable responses when triggered.

Hello, all! I need help constructing a piston that triggers my Goodbye and Hello routines when everyone comes and goes from the house. It’s important the routines trigger quickly, because they include opening/closing doors and locks.

I had been using the built-in ST “automatically perform this routine when everyone leaves,” but my hubby’s phone (not on WiFi all the time) is an unreliable presence sensor. I now have sensors in his vehicles to serve as backup when he comes and goes. Here’s my first stab at this in WebCoRE (I pasted in sensor names so it might make some sense):


  1. Does this need to be similar to the CoRE latching piston? If so, how would I do that here? I’m frankly fuzzy figuring where in the second “if” statement to make that change, if needed.

  2. Will this work with conditions only, not triggers to automatically trigger the routines to run immediately when presence is detected?

  3. I don’t know to set up the condition of Greg’s three sensors (Greg phone, Greg car 1 and Greg car 2) to reliably show if he is here or not. The car sensors are simple, because they are either present or not, depending on when they leave house. But, if Greg’s phone is NOT on WiFi and he leaves, his phone still shows he is present even if he’s left in one of the other vehicles, and the hello/goodbye routines wouldn’t reliably fire.

Any and all help and suggestions greatly appreciated.

If you use triggers you need to stick with triggers. Here’s an idea on your husband’s presence:
Declare a device variable and set it to the three physical devices (phone and two sensors), let’s say it’s called husbandDevices

Declare a string variable and set it to this expression:

count([husbandDevices:presence]) > 1 ? 'present' : 'not present'

This will be present if at least two of the three devices are home, not present otherwise.

enable advanced statements in the options menu in the editor and add an on event statement. Add the 4 devices and chose presence for the attribute. Inside that on event statement, use conditions.

if Lisa’s presence is present or {husband} is equal to ‘present’ then
…arrival tasks…
…departure tasks…
end if;

You’ll need the random() function. Someone has posted one already but can’t remember where :frowning:

1 Like

The Body looks like this – should it be in a different format?

The content type should be JSON. The latest version of webCoRE (0b2+) allow parameters inthe query string too. You will find them under $args.params.name

For example, ?test=1 would be accessed via $args.params.test

Only the virtual devices are covered by SHM.

If Contact Sensor 3 opens and then closes before the 20 seconds elapse, Contact Sensor 11 never opens :frowning:

That’s odd. Just to clarify, contact sensor 11 never opens or opens and closes immediately or stays open but never closes? Have you checked the logs?

Also, did you follow @c1arkbar earlier recommendation and change the ifs to be async?

Working example:

Receiving end…

Hey I was just wondering if somebody knows off the top of their head, the correct syntax for comparing lists. I basically need to do:

If Weather Station’s weather is any of “sunny partiallysunny mostlysunny”

Is the correct syntax quoted by word? Space delimited? Comma delimited? Something else?

‘“sunny” “partiallysunny” “mostlysunny”’
“sunny partiallysunny mostlysunny”
“sunny, partiallysunny, mostlysunny”


Comma delimited and quotes around everything like in your last example. Also it is case sensitive.

1 Like

Stupid question, but I can’t find the answer anywhere:

If I “Make a GET Request” with JSON, point it to a PHP page which returns a valid JSON string, how do I then access the result? I thought it was $args but when I dump this to the log it as blank.

Thanks in advance


Thanks @ady624! I’ll try it out. I’m still learning about the flexibility and power of variables.

1 Like

The new version of the beta has a new $response and $response.XX variable that might be what you need.

Make a GET request to https://jsonplaceholder.typicode.com/posts/1 with type JSON;
Log info "ID: {$response.id} \r Body: {$response.body} \r Title: {$response.title} \r userId: {$response.userId}";

+540ms ║║ID: 1
+540ms ║║ Body: quia et suscipit
+541ms ║║suscipit recusandae consequuntur expedita et cum
+541ms ║║reprehenderit molestiae ut ut quas totam
+541ms ║║nostrum rerum est autem sunt rem eveniet architecto
+541ms ║║ Title: sunt aut facere repellat provident occaecati excepturi optio reprehenderit
+541ms ║║ userId: 1

1 Like