Get Piston State


#2

What is a use case for this? There is no easy “if piston A is paused then…”

If you are pausing the pistons via the action “pause piston” then you could set a global Boolean variable true/false when paused/running.

If you are just clicking the button to pause then I don’t have any ideas for you.


#3

submit a feature request for @ady624 to provide function for access to piston state attributes. :slight_smile:


#4

I second this request, here is a use case example…

Piston 1 a laundry monitor piston that sets its own piston state to ACTIVE if either the washing machine or dryer is currently running and IDLE once it stops.

Piston 2 is an away setting piston that monitors presence changing to ‘not present’. If everyone in the house leaves and the front door is unlocked, or the garage door is open, or THE LAUNDRY IS ACTIVE, then send a notification.


#5

moved to feature suggestion category


#6

Sorry for taking so long to reply. Work has been killing me lately
Here is my use case. I have tablet controller which I use to control my hue bulbs directly through the Hue bridge. I also have the bulbs in smartThings so I can control them with motion. What I want to do is pause the piston when I touch the tablet. I know I could just create a virtual button and have that turned on/off by my tablet and then the piston A would Pause or resume piston B, but I don’t want to maintain all of those virtual buttons.

What I’d like to do is use the External URL generated for the piston to pause or resume the piston. Since I could find no way to send an update via the external URL to pause or resume the piston, I thought I could create another piston that only has an action that would Pause/Resume Piston B.

I thought about doing that, but that can cause a bit of out of sync condition. If piston B fails to update the variable for some reason then piston A wouldn’t perform the correct action. I just figured getting the piston State was more exact and leaves no chance for error.


#7

Depending how you are executing the external URL creating another piston to pause/resume could be a single piston for as many pistons you want to pause and resume. Just depends if you are able to attach arguments to the end of the URL or not.


#8

I figured as much but I couldn’t find a way to pass arguments either.


#9

How are you executing the URL?


#10

I am using an http gateway in an app called iRule then passing the external URL to the piston. I know how to pass params, but I have no idea how to get the piston to consume the params.


#12

use $args.paramName1, $args.paramName2, …


#13

So I would put that into an if statement?

I don’t suppose you could show me an example, could you?


#14

heres one for ifttt wu pollen count i use … if you need more just ask


#15

I’ll give it a shot. Thanks!


#16

sure thing.


#17

@bangali
Without thread hijacking too much - could you either post your WUPollenCount piston to the examples or if its already somewhere drop a link? I am working on something that needs pollen counts for my area - but trying to avoid reinventing the wheel :slight_smile:

I’d like to use the pollen count for some internal home bits, but if i could then take that and push it to my weather site, which I should be able to do a push from WebCore -> myURL for processing I would be one extremely happy (and less sneezy) camper


#18

no other category seems appropriate, so let me just post my response here.

i started working on the pollen count piston using ifttt at the request of an user who asked for an example using http requests. unfortunately after spending a little time on it, i found a couple of things that didn’t work for my needs:

  1. ifttt does not provide a way to get current pollen count
  2. if i used ifttt current pollen count rises above to get the current pollen count, i would have to setup 12 applets to get it to trigger every time the pollen count changed to 1 - 12. somehow i couldnt get excited about setting up 12 applets to do this one thing.

so, the piston i have now is still a snippet and not a full fledged example that i would feel good about sharing. there are other parts from the snippet that i shared at link below, in case thats useful for you:

my intent has been to find a pollen api, hopefully freely available, then build an example with that. but, just been distracted with other things.

sorry, i wasnt more helpful.


#19

Thanks – I have not found a pollen open API … been searching a while then gave up … if you find one do let me know :wink:


#20

sure thing, will do. :slight_smile:


#21

@bangali hmm this thread has burst my bubble! I was hoping to find a piston which would push a notification to my phone if the pollen count in my area on a particular day was going to be high. But from everything I’ve read it sounds like the issue is a getting a data source with API to get the pollen data - I saw something that may have helped but it was only available in the US and I’m in UK.


#22

sorry.