[RELEASE] Weather-Display With External Forecast Driver

The error occurs when I hit Save Preferences.

The "extSource: 0" does not look right? That variable is initialized to "0" so that it is not null, but the valid values are 1, 2 or 3 for 'None, APIXU and Dark Sky respectively. What does your preferences show for Select External Source?
image

Open the Driver Code. Change line 150 from:
extSource = 0
to
extSource = 1
save it and then open your driver and 'save device'.

Does that help anything?

Can somebody walk me through how to install [Weather-Display With External Forecast Driver] - giving me a dummies guide please? I have added it as a driver within Hubitat hub - what next? How do i get it on to SharpTools

Confirm the following:

  1. You have your own Personal Weather Station hardware
  2. You are running Weather-Display software and it is creating the output file clientraw.txt file on a webserver you can access.

If you do not have both #1 AND #2 above, this driver will not work for you. If you do have both of the above, confirm you have installed the json-webservice-wdlive described in the first post. If you have made is this far and you are still having problems, let me know specifically what you are having an issue with and I will attempt to help.

thanks matthew for getting back swiftly and i can safely answer no to both those questions. Is there an alternative of having a weather icon on SharpTools?

Try @bangali's APIXU driver. No PWS required.

2 Likes

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.