How to get past subscription error?


Anyway to get past the subscription error? Trying to start out real simple with a piston that’ll do something based on certain weather conditions (you may remember my post about string lists) that are from a smart weather tile device. So basically this piston should send a notification anytime the weather is any of the conditions listed in variable.


Since you defined precipitation as a string, I think it only recognizes that as a single value which is why your trigger is not subscribing to any events since it doesn’t recognize such a weather condition. Unfortunately, I haven’t figured out myself yet how to initialize a variable to a list of values like you are trying to do. Try eliminating the variable and put all the weather types directly in your changes to statement and see if it works.


hi Gene

The crux of your problem is line 26
It is not recognizing your ‘precipitation’ variable correctly. I don’t know why, however instead of using the variable there just enter in the info that you were storing in the variable as a value for that line statement.

Or do it is an expression and put curly brackets around your variable name in that statement.


Not sure if that will evaluate correctly, but gets rid of the error.

You may need to change the locgic to something like :

If contains(precipitation, [weatherstation:weather]) is ‘true’
Do stuff


Can I ask you guys another question? Does it matter if you have spaces in between the values in the string variable?

Should I be like this…

Or like this…
1, 2, 3, 4


Not sure if you ever got this working. I don’t think it matters on the spaces but I also don’t think your variable Precipitation is recognized as a list for this type of comparison. I suggest you use the contains function:

`boolean contains(string haystack, string needle)`

Returns true if the  `needle`  is found anywhere in the  `haystack`

So your comparison expression for the if would be contains(Precipitation,[Weather Sensor 2:weather])


@guxdude This is the format I went with - no good?


If it works, it’s good. Honestly, I’m still learning myself how webCoRE handles these string lists. Sometimes they seem to be treated as pure strings and other times it recognizes the list. Do you know if it is working?


I ran a quick test and either way should work as long as the capitalization is correct. The check will be case sensitive. So your piston as is should be fine assuming the response from your sensor is always capitalized. Have fun.


Ultimately this is the final piston that I’m hoping works - does anyone see any issues with it? Basic idea is to set a variable when the last precipitation wise, send a notification when contact sensors are open during precipitation after five minutes, open/close a virtual water sensor based on precipitation and display data in piston state.


I think on line 26, you want change to ANY OF as you had in your first piston. On line 46, this would trigger at the same time as line 26 since both are weather changes. Right now this does not seem to be subscribing to any events but I don’t understand why.


Here is the actual final piston - done and confirmed it works.


Still having issues. Got the most recent precipitation to display in piston state correctly but now I’m not able to change get the state of the simulated water sensor to report accurately nor the Boolean variable. Added overcast to the list of precipitation so I wouldn’t have to wait for any and it’s overcast now but yet water sensor says dry and Boolean variable says false. It’s weird because it changes to wet and then gets changed right back to dry.


But changing it to this fixed the water sensor issue but makes the current precipitation variable read wet because of using the currentEventValue system variable. How can I fix this?


You have two if’s with the exact same trigger/condition. Just put the with into the first if right after setting the variable values. In fact, you can set the variable values in the same with water sensor statement. Will be much simpler and cleaner. Same for the else portion. Something like below. Of course, you have to put your devices back in.


@guxdude got so frustrated this was taking me so long I stayed up late last night after the game (Go Pats!) and came up with this. Seems to be working. Thanks for your response.


And wouldn’t you know it it looks just like yours. Thanks again.


@guxdude actually only difference is I had to use [Smart Weather Tile:weather] instead of currentEventValue because it kept reading the current event as the water sensor changing to wet.


Glad it seems to be working. Events can sometimes be strange. I had a problem where I was triggering on mode change but it didn’t always tell me the current event was a mode change. Sometimes you just have to work around the idiosyncrasies. Still strange your piston doesn’t show event subscriptions (lightning bolts).