[DEPRECATED THREAD: visit community.webcore.co for assistance] WebCoRE - Example Pistons

I’m trying to mimic your code for my umbrella reminder message through my speaker and until I saw your post I was using the current chance precipitation provided from the smart weather station tile device. but ive always felt like it wasn’t enough because currently could be no rain but in the next 2 hours could be 100 chance rain. for the purpose of the umbrella reminder it was unreliable. if I understand your code correctly you have an expression which evaluates the max POP for within the next 4 hours. and if its lower than 30 it will say you probably wont need an umbrella.

Ive tried to amend this for the next 6 hours. however in the evaluation box I’m just getting a 2 does that mean the max chance in the next 6 hours is 2% or does the 2 represent something else? I ask because the wiki is kind of confusing to me the way it explains what return you will get the example says something about 40 percent… but the example return shows a bunch of single digit numbers.

Probability of Precipitation
Syntax
$weather.hourly.hourly_forecast.pop
Returns
Returns the probability of precipication. Probability of precipitation refers to the percent chance that a specific location (i.e., the local airport) will receive measurable precipitation (.01 inch of rain or melted snow) in these type of weather conditions. For example, on ten days when the weather is similar to today’s, the airport will receive at least .01 inches of rain on four of those days if the chance of rain is 40%.

Example
[0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 4, 5, 5, 6, 6, 7, 7, 7, 5, 3, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 3, 2]

Sorry about the wiki. I didn’t really understand the weather underground and think I googled that. But it was also a heatwave here so I was confused on the results as well.

2 Likes

This thread is for providing examples of working pistons, not debugging :wink: what does forecast[1].pop say? Please respond in the help thread - note that in any piston you can quickly debug expressions directly in the Evaluation Console

3 Likes

My apologies I will delete and post there

@anon36505037 unfortunately the easy option to choose your own icon didn’t stick. I changed to arrival sensor, added the pic and then changed back to simulated switch and the icon in the app changed back to the previous ST icon :cry::cry::cry:
Lol hard route it is then

OK - another example piston to highlight the new Weather Underground icons, rangeValue() function and parsing WU forecast data. This piston will display the forecast for the next few days & nights, tile color adapts based on the average temperature for the given tile:


The piston can be easily changed to use Celsius rather than Fahrenheit for the temperature by changing the boolean variable at the top.

This piston is based on an original implementation by @anon36505037.

6 Likes

Here’s a simple piston that I’m using for my smart fan control. The GE smart fan controller is handled like a dimmer. So even though there are only three fan speeds, the Level can be 99-67 for high, 66-34 for medium, and 33-1 for low. There is a nice DTH that makes it easy to change the speed by clicking a button in the smartthings app, but I wanted to be able to change the speed with a single tap of the wall switch. Additionally I wanted to be able to change the speed with a single button press with my harmony remote, which treats it as a dimmer as well. You could use this same logic for any dimmer. Like maybe you only wanted three light settings, full, half, or 10% brightness.

Here the Welcome Home announcement piston. Since my exterior doors do not have sensors installed, I use an alternate method to track that. my doors are listed as switches. The code can be moded to alter the switches to contacts. Oh and this one is setup for random phrases for each individual arrival or group arrivial.

Updated version of the weather forecast piston (added icons to the temperature and humidity in the footer to make it a little more obvious) and added an hourly forecast piston (for the next 16 hours - time can be changed to show either 24h or AM/PM using the boolean variable at the beginning):

!

Edit: The most recent version of these pistons can be found on the webCore wiki. The version posted there now uses the rainbowValue() function for a smooth color gradient for the tiles based on temperature.

4 Likes

This piston displays tiles for multiple presence sensors (phone or other sensors) presence. it works based on the presence sensors arrival and departure. don’t think anyone has more than 16 presence sensors to a location so there is no explicit check for it, but since only 16 tiles are allowed take care not to add more than 16 presence sensors to the devices list. all other details in the image. this is self contained and does not use any global variables. (if i missed anything or you need more details, just ping me.)

3 Likes

I imported your awesome weather tiles piston, @bfara83, and I’m noticing that tiles 15 and 16 are only occasionally updated. Tiles 1-14 update on every run, but 15-16 only once every few hours (for instance, it is 10:30 PM and they last updated at 11:40 AM). It appears they are not being executed at all in these cases, looking at the trace information. Have you experienced this?

Clang,

I never had any issues with it updating all of the weather states but I’ll have to post my new version. I switched to use both Piston State and Piston tiles but had to split into 5 different pistons so it’ll work with the color conditions I setup. It was too big to be in one piston but leaving the one I posted earlier as an example of you only want the Piston states.

I’ll do that later today.

1 Like

Guess i am a little late to the program, but have been looking at ahndee
ANDREAS A.
Community Master
weather tiles & was wondering if these are used in Action tiles? if not where can these be seen.
Thanks Mike

No, not ActionTiles. They are used on the webCore dashboard

1 Like

I installed your piston you posted on #495 above & nothing is showing up in my dashboard.
My dashboard says (beta) below it. Is there something I have missed?
Mike

Don’t click on the dashboard link. The tiles will show on the main webCoRE page.

To enable the tile go to settings and create a category and set it to ‘tiles’ or one of the options with tiles in it.

Then make sure your piston is set to that category.

2 Likes

Took a while but have it working now
Thanks Mike

1 Like

Now I need to learn to add the other items to the tiles.
Presence
Light control
Window & door sensors
Thermostat
motion detectors
Switches.
Have pistons running that have some of these items in them guess I need to add a statement to add tile.
This is a real learning process for a 67 yr old man that did not grow up with this type technology

Mike

2 Likes

You’re doing a great job then :wink: and you’re adding tiles because you want it, that’s always good :wink: have fun.

May I recommend picking up on pistons already made by others? Guys, any examples? @ahndee is the McDaddy of All Tiles of Mordor.

2 Likes

This is just a test piston illustrating the arrayItem() and piston tile constructs — it actually doesn’t perform anything useful :wink: It includes the not-often-seen execute-piston command that you may use to create executable tiles.

Just import the piston using the backup code, save the piston, then click on the Test button (since it doesn’t subscribe to any events) … then go to your dashboard. You can click on Tiles 1 (message in log, also restores tiles after you click on Tile 7) and 7 (clears tiles). Uh, just ignore the actual display contents of the tiles, LOL.

… produces:

webCoRE_arrayItem-test_1b

4 Likes