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

I got this so far and seems to work when using the contains function. There’s been times there was multiple alerts so I was trying to find a way to pull out correct alert if there’s 2 or more alerts and I got that working using the contains function (not sure if it’s the most efficient way but it works). Only question though is I’m trying to get the Weather Alert value that occurred previously once the alert clears, would I use $previousEventValue to achieve that so I can use in the Piston State?

Use the piston code to set a variable instead of defining it at the top.

In your code if you want it to persist through then do not update the lastAlert until there are no more alerts.

If $weather.alerts.alerts.length = 0
Then 
clear all your variables

Otherwise you are overwriting them with every change. Maybe even rework how it checks based on how many alerts there are using the example above. Also start small scale and make sure things work before scaling up all the way.

1 Like

Great suggestions, I’ll look to implement the alert length like you suggested and look at further improvements before I consider this to be done. The alerts part does work at least when I tested it. I tested with setting the variable manually and testing the Flood Advisory I have in my area now.

1 Like

@astetnix have you considered using ST contacts for notification? see below thread for more info on how to enable contacts. note, once you have enabled contacts in ST you will need to go to the webcore smartapp settings to select the list of contacts available to webcore.

if you are specifically looking for a way to send text messages, please confirm and i will take another look at the piston to see what might be the best way to do that.

1 Like

[quote]($currentEventDevice == ‘simPresence’ ? ‘5558675309’ : ‘5557779311’)

Change simPresence to one of your presence sensor devices. The first number should match the number for the presence sensor you enter. The second number will be the other phone number.

This will go in the number field but change from value to expression
[/quote]

This was the answer I gave her one the facebook group. But I would agree that using contacts is better.

1 Like

@c1arkbar ahh, ok. thanks for letting me know. i dont do FB, so dont see anything posted there.

Yes. I want to have a text message sent to the phone that triggered the presence. The are is in the end of the piston.

ok. if you have not seen it, @c1arkbar responded to you on FB … he posted the response above as well.

that should solve it.

1 Like

Can I get some help please?
I have the following piston setup. I have a door sensor on the door to the downstairs bathroom. The piston works as expected when someone goes into the bathroom in so far as the light comes on when the user goes into the bathroom and closes the door. When they leave, the light in the room goes off and the variable returns to false. All good. But if someone goes into the bathroom to wash hands etc, they don’t close the door to keep the piston running as expected. So when they come out and close the door the light stays on. What I can’t seem to get to work is:
if door stays open for more than 20 seconds,
when door closes,
Switch light off and reset variable value to false

dont have a contact sensor on my bathroom doors so picked a random one … but this should work for the scenario.

1 Like

@bangali many thanks for the help. One question though, line 39 states ‘X set variable {ocCupied} = {!ocCupied}’. What does this line mean? Im assuming it means the same as my line of ‘x set variable {ocCupied} = False’? If so, out of curiosity, why would you use your expression? Im just curious to see what the difference is - this is a good learning experience for me. Also, taking that one step further, I assume {!ocCupied} means false and leaving the expression as {ocCupied} would mean true? Thanks for your help

Hi @ady624 I’m trying to formulate a web request based on the following CURL:

curl -X POST “https://home.sensibo.com/api/v2/pods/XXXXXXXX/acStates?apiKey=YYYYYYYYYYYYYYYYYYYYYYYYYYYYYY” -H “accept: application/json” -H “content-type: application/json” -d “{ "acState": { "on": true, "targetTemperature": 72, "temperatureUnit": "F" }}”

I’m having a difficult time getting the syntax correct. I’ve tried using variables and using both JSON and FORM but keep getting an error “Invalid ternary operator. Ternary operator’s syntax is ( condition ? trueValue : falseValue ). Please check your syntax and try again.” I also tried using both with the -H statements and without but get the same error. Please clarify the proper syntax for the command so that I can use it as a jumping off point for creating the others that I need to set up. Thanks so much.

I did some more digging on this last night. Even deleted and readded the routine and still have the same behavior. Not sure what I’m doing wrong here but I have a couple of other routines that are exactly the same that work perfectly, so…

Can’t get my nogging around this one this Monday morning …

What’s the best way to have a piston run EVERY X MINUTES or ON EVENT FROM?

Thanks

Pick the timer option is one way.

Yeah, the complication I’m having is how to use a timer with ON EVENT from. I want to run every 5 minutes OR on event from.

Anyone have any experience with Samsung Radiant speakers. I have one working with smartthings, and webCore. Works pretty good for announcements, alerts, etc. I was wondering if there was a way with webCore to set the input to Bluetooth.

I have mine hooked up to an echo dot. It seems to lose connection, to Bluetooth. I figured out it when I play music on the speaker using the native app, it changes the input to WiFi. I was thinking a simple piston could solve this, but don’t see an option for input. Might not be possible, but was hoping someone else might have done something similar.

Which one do you have r1 or three or five?

I have the R1

Does the firmware version on sensors have any impact on Webcore routines?