Question about Time Condition


#1

I am still getting started with webCoRE, but making (slow) progress.

I want to create a piston to send me a text if two conditions are true:
–the garage door is open
–The time is after 10 PM and before 6 AM

I think I have figured out how to use the Samsung Multipurpose Sensor to detect if the door is open, and I can get a piston to send me a text.

But I am having trouble with the time.
I am thinking I should set an IF using a Variable.But, if I pick $time, it is a string variable and I cannot set a condition for BETWEEN.

Should I be using a different variable?

Thanks for any guidance!


#2

Try using the Virtual Device Time vs. the $time variable.


#3

Something like this???


#4

Actually this is a better way of doing it.
WHILE the conditions are true you will get an SMS message every 15 minutes.


#5

This is great! Thanks for several suggestions—solved the problem!

Related questions:
Other than closing the garage door, is there an easy way to turn off the “alarm”? I guess just open the piston and push Pause?

Is there an easy way to see the current status of all the current parameters on a device, like the Multipurpose Sensor?

Thanks again!


#6

If by alarm you mean the SMS message, then as soon as the contact is closed or the time window expires, the WHILE becomes false and the piston stops.

I’m not sure what easy means but you can see the parameters for some devices in the IDE. Log into the IDE then click on Devices. Click on your device.


#7

Thanks–that’s useful.
Appreciate all the help!


#8

Feedback:
Just to be clear Time usually always trumps everything. What Im saying is The trigger here is time between! Then it looks if the conditions are met with the door open. I always write with the time first to help remember that.

Yes the closing of the door will turn off the alerts. But lets say for some reason you want the garage open during that time period! Say you’re having a party in the driveway/garage and ran long. Now your getting messages all night. There is a way to pause the piston without going to webcore. I create Virtual switches in the IDE that show up in my Things list in the ST app. I usually label them starting with P for Piston(that way all pistons group together in the things list) and then something like Gopen or Gtext. You would then just add a restriction to the code you have above that if this Virtual switch is off to run the code. when you get your first text and you’re partying then you just press the virtual switch and text messages stop. Garage stays open and the party goes on! Now what if you forget to turn the switch back off when the party’s done? I go to one off my Routines, Usually morning routine but in this case I would do my Night stay routine(which is set when we go to bed) to Turn the switch off when it changes to whatever mode you would like. Essentially its a reset for every day, in case I forget to turn switch back on, that way I’m not circumventing the purpose of the piston. Food for thought!


#9

Thanks much! I’m not quite ready for the level of complexity you describe, but food for thought, indeed!


#10

Its actually very simple to do. Once you do the first one you will add them to all your pistons.


#11

How exactly does one create a Virtual Switch? By IDE, do you mean the ST IDE (by clicking New Device on the My Devices page)? And, if so, what do you pick for Type? (It’s a long list, but I didn’t see any choice that would obviously be what you were referring to.) Thanks!


#12

Found it. It’s what I was thinking, except I scanned through the long Type list too quickly. It’s not called a “Virtual Switch” in this list but rather a “Simulated Switch”.