Importing a Piston


#1

I am new to WebCoRE so please forgive me if I ask questions that may sound dumb. I am trying to install the following piston from backup code: When i install it, the devices in the backup don’t exist on my list but when I select the ones I want, I am still left with lots of undefined devices. How do I remove them? Also, under define, where it says device below10; is this where you set the threshold? and then change the message in the if condition right?


#2

It’s ok i think i figured it out :slight_smile:


#3

I imported the above mentioned piston and modfied the threshold as you can see to 90% as I know two out of 3 of my monitored devices fall in that threshold. My piston screenshot below. But I am not receiving any text message and I pressed test button too and no text messages. When a battery percentage drops below the given threshold how often until I change the battery is the script above supposed to send SMS?


#4

Turn on Full logging and post it so we can try and decipher it.


#5

Below is a screenshot with full logging turned on and I pressed test. I just do not seem to be getting any SMS to tell me the battery is low. I know two devices fall below the 90% test value I put because the variable defined as Below10 has those two stored.


#6

I just tried it and it worked for me, verify the phone number you entered. I had mine as 16025551212


#7

100% not working for me. I tried two different numbers both mine and my wife’s number but no SMS comes. Do I have to enable SMS sending or anything?


#8

SMS doesn’t have to be enabled. If you open Live Logging in the IDE and then Test, check if you get any errors. I don’t know what else could be affecting your SMS.

You can set up a simple piston that sends SMS to see if that will go through.

If time happens at <short time in the future>
Send SMS


#9

I checked Live IDE logging and nothing showing there at all. I created a blank piston to just send a SMS every 2 minutes as pictured below but even this isn’t sending anything, i put my number in normal format, do I have to put country code? I am from UK if that makes a difference :slight_smile:


#10

I think I figured it out, it seems I have to put +44 and remove the first 0 from my mobile number. I did that and my test piston worked. I will try it with the battery notification one now.


#11

Can somone kindly explain what this code means:

"The " (count(below10)==1 ? below10 " is below 10%" : below10 " are below 10%")

#12

Seems to be working with the +44 prefix, how do I add multiple numbers?

Also with the code originally posted above with backup code 3e00 How often does it run, like right now I have to press Test to make it run, I can’t seem to see any running conditions. The only condition is if battery drops below X but once a battery drops to that it will remain at that until I change it so how often then does it run?


#13

LOL, I should have asked first if you were in UK :smiley: Some poor dude is probably complaining about notices he’s receiving about low battery for devices he doesn’t have :stuck_out_tongue:

It’s a ternary operator that formats the output to the correct grammar(?)…

condition ? true : false

So the above subsitutes ‘is below’ for single device and ‘are below’ for more than one device.


#14

Oh and the question about how often it will run, that will trigger each time the device reports battery status and will execute your tasks when then condition is met.


#15

Thanks @eibyer

Just so that I understand, the if condition is saving the matches of the below X percent to the variable that is defined called below10. The “then” action is sending SMS that says The “device10 stored value” is or are below 10%. Is that correct? When the if condition saves the matching devices, currently my example is saving two which shows as /* Garden Door and Presence Sensor */ what will hapen when there is more than two? will it be seperated by comma and the last one with a and?


#16

Since I fixed the +44 prefix last night I have not yet received a SMS. How often do the devices report battery status? If I run it manually by pressing Test it works.


#17

What’s the difference between local variables and global variables? Is the local ones what I create in the piston and only available through that piston and no other pistons? and the global ones are common ones that I can use across pistons? so for example I could create a global phone number variable so that I can use it across different pistons and if I need to make a change to the recipient numbers I just edit the single place rather than every piston. Is that correct? Global variables are just global to me right? not global to everyone on WC?


#18

I believe the way you have that piston written it’s using the action of the devices dropping below 90% to kick things off. So if they are already below 90% then they might not fire (?).

You could use a Timer or Time to just run a check each day instead…

Every day at 6:00PM…
IF (and then the rest of your piston).

OR

Time happens daily at 7:00PM…
IF…

That way you’ll know if you don’t get a text that day that all the batteries are fine.

Correct. Local variables are local to ONE piston. Global are variables that can be used by all of YOUR pistons. They are not shared with all of WC.

You can also use “Send Push notifications” which are sent to all devices that have the ST app installed. They don’t rely upon a phone number…they rely on the app. So if you get a new phone you just install the app on the new device and all is fine.


#19

I think you might be right. I’ve modified it to use a timer condition before the IF condition. Here is how my piston now looks. Is there any errors? Sorry it’s my first piston attempt


#20

The expression count(below10) just checks to see if there’s only one device in the variable. If equal to one, use is, if more than one, use are. And yes, webcore was programmed to separate items with proper punctuation :slight_smile: