[RELEASE] Weather-Display With External Forecast Driver

Hi @Matthew, Thanks. I'm going to give this some work this weekend if I have a chance. It should be easy enough to modify the lines in question to ignore the null values.

Would you like me to try to do a pull back to your code if I get it working, or somehow get you a diff?

Thanks!

Here is what happens when you save preferences:

I did change line 150 to 1.

I'm receiving this just letting it run:

Also: MyTile is not updating

[UPDATED] to V3.0.1 03/16/2019

  • Code tweaks and corrections.
  • Attempted to improve the stabilization the preference setting when 'Saved' @CurtisZM @NoWon
  • Attempted to address a null condition on forecast.icon.code for @staze use with meteobridge

I have let it run for some time and it is pulling data on both APIXU and DarkSky at the selected intervals with no errors. My MyTile is also updating. Let me know these issue persist for you.

Let me know what you see and if there is any improvement. Thanks.

Thanks Matt.

Alright, got a bit more. Nuked device and recreated.

Seeing:

[dev:20](http://10.0.6.4/logs/past#dev20)2019-03-16 09:59:00.222 pm [error](http://10.0.6.4/device/edit/20)java.lang.NullPointerException: Cannot invoke method toInteger() on null object on line 378 (updated)

Not sure if it's a typo or not, but that line is:

switch(wd.everything.forecast.icon.code.toInteger() ? wd.everything.forecast.icon.code.toInteger(): 99) {

But changing the first instance to "isInteger()" doesn't seem to resolve the issue. Then I just get a "Cannot invoke isInteger() on null object".

Open to ideas @Matthew

Interestingly, and maybe I'm just unclear... The "Device Name" and "Device Network ID" seem to matter. Like they need to match the stationname in the clientraw.txt... is that the case?

Device Network ID does need to be unique among all your devices, but does not have to match the station name.

This driver is intended to pull the predefined file clientraw.txt that the Weather-Display software creates. I appreciate your effort to alter this to use your other file from another software package, but there are way too many things that can go wrong there that I cannot anticipate, test or resolve for you. If you do not use Weather-Display, then this driver is not for you.

Please feel free use this code and alter it to work with your input file ...... but that should be another thread as it is not related to Weather-Display and I have no way to help you with a completely different input file from what this driver uses.

1 Like

so that is something I'm curious about. Does the driver pull both the clientraw.txt, or does it JUST pull everything.php? I've got clientraw.txt in a different directory than everything.php (but I made the adjustment in config.php for WDL to point at clientraw.txt).

I'm happy to give you a link for what meteobridge is producing. I'm just super confused as to why it seems to keep behaving differently between different runs.

moved clientraw.txt to be in same directory.

Still just seeing

java.lang.NullPointerException: Cannot invoke method isInteger() on null object on line 378 (updated)

which is the updated line from source (since I don't see why it would be toInteger twice on that line).

Weather-Display creates clientraw.txt. Then json-webservice-wdlive creates the JSON from clientraw.txt that this driver pulls.

Then your json-webservice-wdlive is not delivering the forecast.icon.code to the driver. You need to figure out why that is. Open a new browser tab and type in the full everything.php URL to pull the data and see what forecast.icon.code is. see excerpt of that below....

That's what i thought. wdl (json-webservice-wdlive) properly generates the json... just a fair number of lines are nulls.

Can't figure out what's going on. isInteger should see it's null, and set the value to 99.

"forecast": {
      "icon": {
        "code": null,
        "text": null
      },
      "davis_forecast": "Increasing clouds with little temperature change. Precipitation possible within 24 to 48 hours."
    },

also seeing issue with, I think, the driver checking the web server at the same time Meteobridge is uploading the file (Seeing a lot of errors saying it can't get longitude) (errors about line 304).

Yeah... I am going to have to just give up on this I think. The Meteobridge dev has basically said the clientraw format is a mess and probably won't be interested in trying to implement missing functions. =/

Will have to see if I can get my PWS data into HE some other way...

I think you need to figure out why the json-webservice-wdlive is giving null values. That is not expected. Can you trace those back to the clientraw.txt? Are they null (or do not exist) in that file too?

I do not think I understand what you are doing?

  1. Are you using Weather-Display software?
  2. Are you using json-webservice-wdlive to create the JSON data pull from the clientraw.txt that Weather-Display creates?

If so, you should not have null values (at least I do not).

You said you were doing something with Meteobridge? I am not certain what that is or how you are attempting to interact with this driver. If Meteobridge is somehow altering either the tive Weather-Display clientraw.txt or somehow interfears with json-webservice-wdlive pulling data from it, then that is what you need to resolve.

I suggest you get the driver to work WITHOUT involving Meteobridge. If/When you are successful with that, you can try to figure out how to introduce Meteobridge into this.

It is not isInteger(), it is toInteger(). That command converts a text value to it's numeric integer equivalent. (e.q "9" --> 9 ) If the value is null the toInteger() may error out (I don't know)? Maybe try to test the raw data value (without the .toInteger()) and if that is null, set it to 99. Like this:

switch(!wd.everything.forecast.icon.code ? 99 : wd.everything.forecast.icon.code.toInteger()) {

I am not using Weather-Display at all. Meteobridge supports outputting the weather-display "clientraw.txt" file, but obviously not complete. Some of the values end up being "null".

I likely will need to find another option, or write another option based on realtime.txt or something that isn't full of null data. Really, I just want to display current outdoor temp, humidity, etc from my PWS... I don't need a lot of the other data. I should stop trying to shoehorn things to work. =/

That line resulted in the next hiccup:

java.lang.ArrayIndexOutOfBoundsException: 1 on line 452 (updated)

Guessing I'm just going to keep hitting these if we keep on this. =/

Don't worry about it. I'll start hunting for other option, or work on writing my own.

Thanks so much for your help and trying.

Best of luck to you.

@Matthew
thanks but I could not get it to work
maybe I miss-understood but I am just trying to use this driver to only pull weather data from DarkSky
not sure what the purpose for the setting Station Data File Location: *
When we already select the external source and the api key and the location in the preferences.
I suspect this is where I am misunderstanding
Is this only to be used in conjunction with an external weather station?

The old Apixu driver works fine I just wanted to try darksky out.

Do you output to Weewx currently? There’s another driver that might fit what you’re looking for.