Giter Site home page Giter Site logo

Comments (21)

naofireblade avatar naofireblade commented on May 31, 2024 1

Looks like this happens more often recently. Thanks for reporting. I will try to fix this tomorrow.

from homebridge-weather-plus.

naofireblade avatar naofireblade commented on May 31, 2024

Is it not working at all for you or just sometimes? I just tried the api call and the result still fits the parsing code.

    "response": {
        ...
    },
    "current_observation": {
        ...
    },
    "forecast": {
        "txt_forecast": {
            ...
        },
        "simpleforecast": {
            "forecastday": [
                {
                    "date": {
                        "epoch": "1515466800",
                        "pretty": "7:00 PM PST on January 08, 2018",
                        "day": 8,
                        "month": 1,
                        "year": 2018,
                        "yday": 7,
                        "hour": 19,
                        "min": "00",
                        "sec": 0,
                        "isdst": "0",
                        "monthname": "January",
                        "monthname_short": "Jan",
                        "weekday_short": "Mon",
                        "weekday": "Monday",
                        "ampm": "PM",
                        "tz_short": "PST",
                        "tz_long": "America/Los_Angeles"
                    },
                    "period": 1,
                    "high": {
                        "fahrenheit": "57",
                        "celsius": "13"
                    },
                    "low": {
                        "fahrenheit": "51",
                        "celsius": "11"
                    },
                    "conditions": "Rain",
                    "icon": "rain",
                    "icon_url": "http://icons.wxug.com/i/c/k/rain.gif",
                    "skyicon": "",
                    "pop": 100,
                    "qpf_allday": {
                        "in": 1.06,
                        "mm": 27
                    },
                    "qpf_day": {
                        "in": null,
                        "mm": null
                    },
                    "qpf_night": {
                        "in": 1.06,
                        "mm": 27
                    },
                    "snow_allday": {
                        "in": 0,
                        "cm": 0
                    },
                    "snow_day": {
                        "in": null,
                        "cm": null
                    },
                    "snow_night": {
                        "in": 0,
                        "cm": 0
                    },
                    "maxwind": {
                        "mph": 5,
                        "kph": 8,
                        "dir": "",
                        "degrees": 0
                    },
                    "avewind": {
                        "mph": 0,
                        "kph": 0,
                        "dir": "SE",
                        "degrees": 132
                    },
                    "avehumidity": 97,
                    "maxhumidity": 0,
                    "minhumidity": 0
                },
                {
                    ...
                },
                {
                    ...
                },
                {
                    ...
                }
            ]
        }
    }
}```

from homebridge-weather-plus.

naofireblade avatar naofireblade commented on May 31, 2024

Can somebody give me his location? I guess wunderground fails to deliver forecasts in general for some regions at the moment because I have no problems with my location "Greifswald".

I will make the parsing more robust now.

from homebridge-weather-plus.

BuckarooToo avatar BuckarooToo commented on May 31, 2024

The module does load initially, but then will fail within 24 hours. I'm still investigating if the date change is the culprit. Location is in the Boston, Massachusetts, USA area - zip code 02494 is the location I've used in the configuration script.

from homebridge-weather-plus.

naofireblade avatar naofireblade commented on May 31, 2024

Thank you very much for helping with this problem. I checked your zip code and the response looks good so far. The strange thing is, the plugin runs fine in my location for months now. I will keep your location set for some days until the error occurs again.

I updated the index.js to catch exceptions while parsing the data and to log the faulty API response. Can you please replace your index.js with the most recent one: https://github.com/naofireblade/homebridge-weather-station-extended/blob/master/index.js

Your index.js should be located here: /usr/lib/node_modules/homebridge-weather-station-extended/

from homebridge-weather-plus.

BuckarooToo avatar BuckarooToo commented on May 31, 2024

Done. So far running just fine. I'll let you know if it stays up tomorrow.

from homebridge-weather-plus.

sejmann avatar sejmann commented on May 31, 2024

I'd wrapped the forecast update in a try catch a couple days ago, and it caught another error last night, but idiotically, I didn't output the response, so I'm not sure what triggered it. I've now updated to using your updated index.js.

Incidentally, my zip is 89074, although, the error seems very infrequent, on the 7th at 7am, and last night just after midnight, and not once before those two.

Unrelatedly, I did notice 5 instances over the last few days of intermittant errors, appropriately caught, where the server seemed to complain that I wasn't supplying a key, but it seemed to benignly recover on the next call.

from homebridge-weather-plus.

usmcguy avatar usmcguy commented on May 31, 2024

Mine still crashes after running a few hours

from homebridge-weather-plus.

sejmann avatar sejmann commented on May 31, 2024

@usmcguy with the new index.js? Do you have any logs?

from homebridge-weather-plus.

usmcguy avatar usmcguy commented on May 31, 2024

I'm good now, I updated yesterday apparently moments right before the update with the new index.js

from homebridge-weather-plus.

naofireblade avatar naofireblade commented on May 31, 2024

The new index.js ist not yet published to npm because I want to find the error first. I don't want to fill the logs of all users with exception details.

You can fix the problem (and help with testing) by replacing your index.js under /usr/lib/node_modules/homebridge-weather-station-extended/with this one: https://github.com/naofireblade/homebridge-weather-station-extended/blob/master/index.js

from homebridge-weather-plus.

naofireblade avatar naofireblade commented on May 31, 2024

With your zip code I got the error as well. One at 20:57:31 CEST and one at 00:21:32 CEST.
Current conditions and forecast for today (day 0) are fine but forecast for day 1-3 is flawed. Since it occurs rarely I will just catch the parsing exception and wait for the next update interval.

from homebridge-weather-plus.

naofireblade avatar naofireblade commented on May 31, 2024

Fixed in version version 1.1.2
You can update via sudo npm update -g homebridge-weather-station-extended

I will keep an eye on this in debug mode if it happens more frequently.

from homebridge-weather-plus.

naofireblade avatar naofireblade commented on May 31, 2024

Thank you all very much for your help in reporting and fixing this issue 👍 .

from homebridge-weather-plus.

iRonin avatar iRonin commented on May 31, 2024

Just came across this error. Seems it occured only now (after one of the restarts of Homebridge).

from homebridge-weather-plus.

BuckarooToo avatar BuckarooToo commented on May 31, 2024

Not sure if this helps - the module is running well (thanks!) and not exiting after errors. That said, here are examples of the errors generated to help you track this down:

[2018-1-16 09:13:07] [Weather Station] Exception while parsing forecast for day #0: TypeError: Cannot read property 'date' of undefined
[2018-1-16 09:13:07] [Weather Station] Exception while parsing forecast for day #1: TypeError: Cannot read property 'date' of undefined
[2018-1-16 09:13:07] [Weather Station] Exception while parsing forecast for day #2: TypeError: Cannot read property 'date' of undefined
[2018-1-16 09:13:07] [Weather Station] Exception while parsing forecast for day #3: TypeError: Cannot read property 'date' of undefined
[2018-1-17 00:17:51] [Weather Station] Error retrieving weather
[2018-1-17 00:17:51] [Weather Station] false
[2018-1-17 01:02:29] [Weather Station] Exception while parsing forecast for day #0: TypeError: Cannot read property 'date' of undefined
[2018-1-17 01:02:29] [Weather Station] Exception while parsing forecast for day #1: TypeError: Cannot read property 'date' of undefined
[2018-1-17 01:02:29] [Weather Station] Exception while parsing forecast for day #2: TypeError: Cannot read property 'date' of undefined
[2018-1-17 01:02:29] [Weather Station] Exception while parsing forecast for day #3: TypeError: Cannot read property 'date' of undefined

from homebridge-weather-plus.

naofireblade avatar naofireblade commented on May 31, 2024

Thanks. I added a debug option in the release 1.1.2 and tracked that down. I found out that sometimes the weather underground response has no forecast data (just an empty array).
We will have to wait until weather underground fixes the problem.

simpleforecast: { forecastday: [] } }

from homebridge-weather-plus.

iRonin avatar iRonin commented on May 31, 2024

@naofireblade how to enable debug?

from homebridge-weather-plus.

naofireblade avatar naofireblade commented on May 31, 2024

You have to change the homebridge start parameters:

Example: sudo DEBUG=homebridge-weather-station-extended homebridge -D -U /var/lib/homebridge

/var/lib/homebridge is my homebridge folder, it might be different depending on your installation. If you are running homebridge as a service, you can either change your start options or stop the service and start homebridge manually with the given example command.

This only works for plugins that use this package: https://www.npmjs.com/package/debug

from homebridge-weather-plus.

iRonin avatar iRonin commented on May 31, 2024

My log output:

[2018-1-19 12:25:23] [Weather Station] Exception while parsing forecast for day #2: TypeError: Cannot read property 'date' of undefined
Fri, 19 Jan 2018 11:25:23 GMT homebridge-weather-station-extended Response from Weather Underground API:
Fri, 19 Jan 2018 11:25:23 GMT homebridge-weather-station-extended { txt_forecast: { date: '11:59 PM CET', forecastday: [ [Object], [Object], [Object], [Object] ] }, simpleforecast: { forecastday: [ [Object], [Object] ] } }
Fri, 19 Jan 2018 11:25:23 GMT homebridge-weather-station-extended Update values for In 3 Days
[2018-1-19 12:25:23] [Weather Station] Exception while parsing forecast for day #3: TypeError: Cannot read property 'date' of undefined
Fri, 19 Jan 2018 11:25:23 GMT homebridge-weather-station-extended Response from Weather Underground API:
Fri, 19 Jan 2018 11:25:23 GMT homebridge-weather-station-extended { txt_forecast: { date: '11:59 PM CET', forecastday: [ [Object], [Object], [Object], [Object] ] }, simpleforecast: { forecastday: [ [Object], [Object] ] } }

from homebridge-weather-plus.

naofireblade avatar naofireblade commented on May 31, 2024

Hi Ronin, thanks. Your simpleforecast {forecastday} array only has to objects (forecast for today and tomorrow). But the objects for in 2 days and in 3 days are missing. Unlinke the txt forecast, that one is complete but not very useful for parsing.

Some minutes later all 4 objects are in the array. And some hours later maybe not. And then back again and so on.

This is clearly a weather underground bug. Nothing I can do about that.

from homebridge-weather-plus.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.