Some additional information can be found here.
webCoRE Update v0.3.10a.20190223 - adds $twcweather to replace discontinued $weather, bug fixes
Apparently, the CSS for the Fuel Streams changed with the update, so my Stylish code needs to be tweaked to hide the unused data points.
My old code was working perfectly until I updated:
I will not be fixing this graphical tweak until my other 49 pistons relying on the $weather has been adjusted and tested…
sighs
There goes my freetime, LOL
That’s an odd one, last change to the fuel streams page was last June. The good news is that change included explicit CSS classes for fuel streams and canisters, so you can rewrite the Stylish rules to be much more expressive (e.g. .canister-heat-pump .fuel-stream-daily-energy-usage { display: none }
)
It is my fault. I tend to only update apps when necessary, because I know the time involved with changing & fixing my code afterwards.
It serves me right for this double whammy, LOL
Thanks. The browser was showing the updated version but I did not have the warning so I logged out and back in and then I got the warning.
Trying the above expression again it seems to be recognizing the twc expression but it’s still not resolving.
EDIT: Nevermind, I seem to be okay now. Thanks to all who helped.
This worked really well so I could make a text list of the pistons that I need to work on…
I made my notes, and then cancelled the import.
Now, my desktop displays this message:
Can you please clarify what “reset import data” does?
Is there a global search feature?
I have this weather alerts piston that was working before…trying to change it over to the new weather api…
But I am getting this log error…
Any ideas?
It just deletes your “import progress” that is stored in the browser. Doesn’t affect your pistons.
If you use expressions, you can drop the curly brackets if you place the variables outside of quotes.
The “Error retrieving JSON data part null” seems to mean that there is no data there. Do you currently have a weather alert? (check $twcweather.alerts.length
). I think this will happen whenever accessing non-existent properties on these system variables, but it’s harmless insofar as it does not affect execution of the piston but rather just returns a blank value for that expression.
See, that’s how I started as I was just modifying an existing piston that was working for WU (yes, my first screen grab above has single quotes as I was trying everything). But my problem was I needed to log out and back in to pick up the new stuff I guess. Once I did that, as you state I can leave off the curly brackets and quotes.
Thanks
For what it is worth, I use single quotes unless i need a word like: it’s.
That apostrophe messes it up, so in those cases, I use double quotes to surround my text.
The “Error retrieving JSON data part null” happens as you say @ipaterson when there is no data on a weather alert, but also when there is no rain forecast, i.e.
round(sum($twcweather.forecast[2].qpf, $twcweather.forecast[4].qpf, $twcweather.forecast[3].qpf, $twcweather.forecast[5].qpf), 2)
It used to have a 0 value.
+1ms | ╔Received event [Home].time = 1550951588983 with a delay of -775ms |
---|---|
+510ms | ║Error retrieving JSON data part null |
+2576ms | ║Error retrieving JSON data part null |
+3641ms | ║Wind speed = 21 |
+3661ms | ║Error retrieving JSON data part null |
+3666ms | ║Error retrieving JSON data part null |
+3671ms | ║Error retrieving JSON data part null |
+3677ms | ║Error retrieving JSON data part null |
+5943ms | ║Setting up scheduled job for Sat, Feb 23 2019 @ 8:54:08 PM CET (in 54.833s), with 2 more jobs pending |
+5953ms | ╚Event processed successfully (5953ms) |
I tried ’ $twcweather.alerts.length ’ that returns “1”
not sure what that means. Maybe I’ll wait for a weather alert. (We do have one right now for a high wind advisory.)
I have the same alert now and you’re right, $twcweather.alerts.length
shows 1 but $twcweather.alerts
shows [null]
. SmartThings’ documentation for getTwcAlerts()
is wrong, the data is structured differently. While both getTwcLocation()
and getTwcAlerts()
show that you have to access the values via getTwcLocation().location
and getTwcAlerts().alerts[0]
the alert data is actually at getTwcAlerts()[0]
.
I just pushed out a fix for this. Please return to account.smartthings.com > Smart Apps to update the webCoRE Piston smart app if you are using alerts. Continue to use $twcweather.alerts.length
and $twcweather.alerts[0]
in your pistons, this was just a behind-the-scenes fix.
There is an issue with {$twcweather.forecast.narrative[0]} when using Celsius units. Instead of “20 degrees Celsius”, it returns “20 degrees C” (as in “see”).
I use is like this: Today it is expected to be {$twcweather.forecast.narrative[0]}.
Try replace($twcweather.forecast.narrative[0], '/(degrees?) C\\b/', '$1 Celsius')
. That will replace degree C or degrees C with the full word.
I appreciate the suggestion, but it does not seem to be working (apart from if I’m doing something wrong. (I do not have any programming experience and I blindly follow examples)
And
Also, I can’t figure out where to add what to get the statement to work in conjunction with the rest of my expression:
“It’s currently {$twcweather.conditions.wxPhraseLong} with a temperature of {$twcweather.conditions.temperature}°C. The expected Minimum and Maximum temperatures for today and tonight are {$twcweather.conditions.temperatureMax24Hour} and {$twcweather.conditions.temperatureMin24Hour}°C. Today it is expected to be {$twcweather.forecast.narrative[0]}. Sunset will be at {Sunset} tonight.”
I tried :
replace({$twcweather.forecast.narrative[0], ‘/(degrees?) C/’, ‘$1 Celsius’})
replace({$twcweather.forecast.narrative[0]}, ‘/(degrees?) C/’, ‘$1 Celsius’)
but none of these statements work if I add them to my Expression. As soon as I add the latter statements within the “…” of my expression, the statement causes the Expression to fail.
Sorry for being a nuisance.
Ahh it’s 16C
not 16 degrees C
. Looks like you put it in the correct place but let’s use this pattern instead to allow a space or no space following the number: replace(replace($twcweather.forecast.narrative[0], '/([0-9]) *C\\b/', '$1 degrees Celsius'), '/(degrees?) *C\\b/', '$1 Celsius')
That should work properly with variations like 55C
, 55 C.
, 55 degrees C
, and 1 degree C
without messing with words that begin with capital C like 12 Cold days
.