New Plugin: SiteSensor

Help you I can, yessss, mmm…

4 Likes

Wise beyond his years, he is… :nerd_face:

Hmm… alas, closer to Return of the Jedi Yoda than The Mandalorian Yoda am I.

2 Likes

Yoda that is not!.. :wink:

C

Argh, are any other WU users here getting null values appearing later in the day in the arrays for pos1:

"temperatureMax": [null, 34, 19, 22, 31, 31],
"temperatureMin": [21, 12, 12, 11, 15, 17],

Leading to failures ?

18:28:07: SiteSensor: Requesting JSON data
18:28:07: SiteSensor: Set up for HTTPS request, verify="none", protocol=nil, options=nil
18:28:07: SiteSensor: "GET" "https://api.weather.com/v3/wx/forecast/daily/5day?geocode=-37.80,145.32&format=json&units=m&language=en-US&apiKey=a335e9b935f14582b5e9b935f1e58222", headers={  }
18:28:07: SiteSensor: Eval #1: "response.temperatureMin[1]"=("number")21
18:28:07: SiteSensor: Failed to execute `"response.temperatureMax[1]"', { location=26, ["__source"]="luaxp", message="Subscript out of range: temperatureMax[1]", type="evaluation" }
18:28:07: SiteSensor: Eval #2: "response.temperatureMax[1]"=("nil")nil
18:28:07: SiteSensor: Failed to execute `"response.daypart[1].cloudCover[1]"', { location=33, ["__source"]="luaxp", message="Subscript out of range: cloudCover[1]", type="evaluation" }
18:28:07: SiteSensor: Eval #3: "response.daypart[1].cloudCover[1]"=("nil")nil
18:28:07: SiteSensor: Failed to execute `"response.daypart[1].wxPhraseLong[1]"', { location=35, ["__source"]="luaxp", message="Subscript out of range: wxPhraseLong[1]", type="evaluation" }
18:28:07: SiteSensor: Eval #7: "response.daypart[1].wxPhraseLong[1]"=("nil")nil
18:28:07: SiteSensor: Failed to execute `"response.daypart[1].narrative[1]"', { location=32, ["__source"]="luaxp", message="Subscript out of range: narrative[1]", type="evaluation" }
18:28:07: SiteSensor: Eval #8: "response.daypart[1].narrative[1]"=("nil")nil

I read another thread on IPCamTalk that WU shut off their API yesterday or day before. Might that be the issue?

If it was off I’d have thought we’d get no data back?

It’s working again this morning so I’ll see how it goes today.

Hi dJOS,

I also see that all forecast values (like temperatureMax and all the response.daypart[1] change into "nil"values as soon as that daypart is passed. (as I recall day is from 7am to 7 pm and night from 7pm to 7am). SiteSensor gives errrors (“Can’t detect device”) which is a little bit annoying.
I have solved this to make a seperate SiteSensor for the forecasts that only runs daily between 7am and 8am. I have noticed that the forecast values hardly change during the day (at least not for that day and the up following night).
For the actual weather data of my PWS I have another SiteSensor that updates 24/7 every 2 minutes.

WU API is still working for my PWS.

I did wonder if this was the case, thanks.

I think I’ll do something similar - it’s a shame there’s no way to cache those numbers as they are still useful … especially max temp. I was surprised that cloud cover vanished as that seems to be live and change during the day.

Yes. WU is still supporting WU-enabled PWS but have killed off the free API. Supporting PWS is in their best interest as we’re providing free weather data to them. Mine works just fine through their website or the IOS app. I’m not, however, allowed to use my own PWS data in Vera, which is annoying.

Im using the new API as I have a PWS.

Why not? Im using mine via SiteSensor without issues.

Me too. Thanks to Rigpapa I got it working via SiteSensor

Shouldn’t this be response.daypart[1].temperatureMax[1] ?

No as it’s not in the daypart section:

10:36:01: SiteSensor: Requesting JSON data
10:36:01: SiteSensor: Set up for HTTPS request, verify="none", protocol=nil, options=nil
10:36:01: SiteSensor: "GET" "https://api.weather.com/v3/wx/forecast/daily/5day?geocode=-37.8,145.32&format=json&units=m&language=en-US&apiKey=<MyKey>", headers={  }
10:36:01: SiteSensor: Eval #1: "response.temperatureMin[1]"=("number")12
10:36:01: SiteSensor: Eval #2: "response.temperatureMax[1]"=("number")33
10:36:01: SiteSensor: Eval #3: "response.daypart[1].cloudCover[1]"=("number")72
10:36:01: SiteSensor: Eval #4: "response.daypart[1].wxPhraseLong[1]"=("string")"PM Rain"
10:36:01: SiteSensor: Eval #5: "response.daypart[1].narrative[1]"=("string")"Partly cloudy skies this morning will give way to cloudy skies and rain during the afternoon. High 33C. Winds W at 15 to 30 km/h. Chance of rain 100%. Rainfall near 12mm."

Yup, my bad, you’re right. I was working from memory, addled by a very long day.

In any case, I think I can improve on this. It looks like SS is not asking the JSON library to decode “null” to LuaXP’s null, like Reactor does. I’m looking into that… I may have a bug fix/patch for you if I’m right about that one…

Edit: yes, I think that’s it. Install the Github stable branch version. Click the link, then click the green “Clone or Download” button and choose “Download ZIP”. Save the ZIP file somewhere and unzip it. Open the Luup uploader at Apps > Develop apps > Luup files, and then drag the release files (not the folder, the contents, except the .md files) to the “Upload” button.

2 Likes

All good, I went and double checked and was surprised to find you were wrong and I got something code related right. :joy:

2 Likes

hey @rigpapacan sitesensor check if the telnet port is open/available

if so i would love the help with a recipe

SiteSensor does not at this time do generic TCP connections. The immediate follow-on to that request would be some kind of “send-expect” mechanism, potentially with multiple interchanges, and retrieval of data from the ultimate response (or perhaps even one or more of the interim responses). I have not undertaken this yet. Nobody has as yet asked, and the potential for bloat is high. I wouldn’t even consider it until I’ve converted the plugin to parent-child, and doing that without breaking everyone who currently uses it has been a barrier I’ve only recently discovered how to circumvent.

If all you need is a “is TCP port open” test, that’s in NetMon’s wheelhouse right now.

1 Like

Hi
I’m trying to get weekly used water from the Hydrawise controller.
For that on request url i put
https://app.hydrawise.com/api/v1/statusschedule.php?api_key=“MY KEY”
Server response is handled as:
Json data
Value expressions:
response.sensors.0.flow.week

I receive the error:
16:22:10: SiteSensor: Requesting JSON data
16:22:10: SiteSensor: Set up for HTTPS request, verify=“none”, protocol=nil, options=nil
16:22:10: SiteSensor: “GET” “https://app.hydrawise.com/api/v1/statusschedule.php?api_key=MY KEY&tag=hydrawise_all”, headers={ }
16:22:11: SiteSensor: Failed to parse expression "response.sensors.0.flow.week"', { location=20, ["__source"]="luaxp", message="Invalid operator", type="compile" } 16:22:11: SiteSensor: Eval #1: "response.sensors.0.flow.week"=("nil")nil 16:22:11: SiteSensor: Failed to execute “”', nil
16:22:11: SiteSensor: Eval trip expression: “”=(“nil”)nil

When i put the url on firefox i get the attached image

What is happening/am i doing wrong.

Thank you