Cant figure the weather out


#1

1) Give a description of the problem
Trying to make the light strip display color base on the weather right now.

2) What is the expected behavior?
Color change base on weather outside

3) What is happening/not happening?
The variable weather shows null.

**4) Post a Green Snapshot of the piston!
https://gyazo.com/dd925e2abf5c4e516aaa5d35513c8927
https://gyazo.com/964e2048a0db03cbece68c8eb1c8093e


#2

Move your weather statements out of the variable definition and into the execute part of your piston.

IF
contains($weather.conditions.current_observation.weather, ‘Rain’)
is true
THEN
with Stair Light
Do Orange

etc.

I don’t think functions in variable definitions work. Your syntax for the weather conditions are correct.


#3

Thx, but the thing is when I test for it, all the statement return false. The variable for weather is showing null, i just couldn’t figure out why.


#4

Because the variable won’t process the weather statement - it needs to be in the executable part of the piston.


#5


This is what it looks like on mine. it did not show partly cloudy or anything. Thx, I change it to this format now: https://i.gyazo.com/56ad4040ee8b978a3be83d79ecfceb4d.png


#6

Do you have a location or zip code entered for your hub? It needs that to pull local weather.


#7

i think so there is my ide screen shoot


#8

Thx I figure it out, i also need to setup location on the setting in webcore :smiley: thanks a lot!!!


#9

Just for future reference, expressions can be used in variable definitions. Dynamic variables are evaluated each time they are referenced within a piston. This method of defining variables can sometimes be useful for decluttering pistons and preventing syntax errors by eliminating unnecessary ‘set variable’ statements and/or the need to repeat a complex expression multiple times in the body of a piston.

I have example of this here.


#10

Yeah, my fault on that one - I was trying to figure out why it wasn’t working for him but I could get it working on mine just fine. I know people have reported issues with expressions not being evaluated in their variables, so I started there. Once it didn’t work in the executable, it was definitely something else.

Thanks for the heads up!