Better grasp on how to grab data


#1

So essentially I have been messing around in webcore and browsing the forums here but have hit a wall with understanding when and how to use some settings. Trying to get a better grasp on when/how a value or expression or variable, etc, applies. The example I am using is based off the local weather station smartapp reporting and how to get usable information out of it.

1) Give a description of the problem
Looking to grab for example the forecast for tomorrow as reported by the local weather station smartapp

2) What is the expected behaviour?
To grab the data but do not know what to use i.e. value, expression, variable, etc

3) What is happening/not happening?
Not knowing what terminology to use or how to write it

**4) Post a Green Snapshot of the piston!

Data I am trying to get to;

How I have been trying to get to it

5) Attach logs after turning logging level to Full
does not apply

REMOVE BELOW AFTER READING
If a solution is found for your question then please mark the post as the solution.


Help with Boolean intergration
#2

So what kind of device is this Local Weather Station?

In the Evaluation console, type this as an Expression and see if you get any output.

[Local Weather Station (Device):forecastTomorrow]


#3

This is a device listed in my IDE based off a smartapp. Its called “Rboy SmartWeather Station Controller”. So pulling data off my zipcode info and acting as a device from what I understand.

When typing that into an expression console it tries to autocomplete after the " : " but forecast is not one of the options.


#4

When you view a piston, scroll all the way down and you’ll see the Evaluation Console.

image

The auto completion is only for webCoRE’s built in functions and defined variables.


#5

this is what it I got back

“(expression) [Local Weather Station (Device):forecastTomorrow] »»» Evaluation error: Invalid device variable Local Weather Station (Device)”

And then ran it without forecast and got this

“(expression) [Local Weather Station (Device) »»» Evaluation error: Variable Local Weather Station (Device) not found”


#6

Type in the device name as you have it in ST. It might be just Local Weather Device, I was just going by your screen grab up top?


#7

That in fact is its name correct


#8

What about [Local Weather Station:forecastTomorrow]


#9

Got something that time!

“(expression) [Local Weather Station:forecastTomorrow] »»» (string) Mainly sunny. High 92F. Winds NNE at 5 to 10 mph.”


#10

So that’s how you will extract data from your device. Use the Name column in your screenshot above for the attributes that you want to get from the device.

Use the [deviceName:attribute] format to get the info you’re interested in.


#11

Tinkering with it now, think I am grasping it. Could I extract or act on just 1x part of that snippet of data? For example the entire line reads “Mainly sunny. High 92F. Winds NNE at 5 to 10 mph”, could I somehow get the push just triggered off the “sunny” part of that line?


#12

You can play with some of the text functions to squeeze out the bits you want…
https://wiki.webcore.co/Functions

contains([Local Weather Station:forecastTomorrow],“sunny”) will give you true.


#13

Cool, will start more reading! Thank you so much for all your help today!