MagicMirror Forum
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • 3rd-Party-Modules
    • Donate
    • Discord
    • Register
    • Login
    A New Chapter for MagicMirror: The Community Takes the Lead
    Read the statement by Michael Teeuw here.

    Weatherunderground - currently - hourly - daily - configurable

    Scheduled Pinned Locked Moved Troubleshooting
    126 Posts 26 Posters 225.7k Views 13 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • RedNaxR Offline
      RedNax Module Developer @Pauliolio
      last edited by

      @Pauliolio

      Your api-url would be this:

      http://api.wunderground.com/api//conditions/forecast10day/astronomy/alerts/lang:NL/q/pws:IBATTLE3.json

      pws stands for personal weather station.

      Did you set your locale correctly in config.js? The sunset time for the wunderground module comes from the weatherunderground api so reflects the time at the weatherstation location.

      The loctype thing is a bit of a mystery. I copied it of a wunderground generated url. Not entirely sure what it’s for. You could just leave it out i think.

      P 2 Replies Last reply Reply Quote 0
      • RedNaxR Offline
        RedNax Module Developer @Snoevit
        last edited by

        @Snoevit When you remove /astronomy you just modify the api call. The script still tries to place the (now absent) information on the screen. Leave the api call in tact and modify the refresh_dom function in the script. Also further down there’s a windspeedconversion which you could try to modify.

        S 1 Reply Last reply Reply Quote 0
        • S Offline
          Snoevit @RedNax
          last edited by

          @RedNax
          Thx for your reply! I forgot to update my post to tell you that i found how to remove the ‘rain-part’ :P But thanx for the note on the windspeedconversion!
          Oh, a also figured out my problems with the icons. i replaced the files in the vendors folder, exept for weather-icons.css. I thought those two files were the same, until i saw them side-by-side :)

          1 Reply Last reply Reply Quote 0
          • S Offline
            Shockwave @RedNax
            last edited by

            @RedNax , sorry for the delay, I’ve had company and then had to wait for an alert message. My config doesn’t have the alerttruncatestring even in it. I’ve copied both the results of the Wunderground alert and the text from the NWS. I wonder if it’s dying at the /u00A , which appears to line up perfectly with a CR/LF from the NWS text. It’s also the first item in the message, which could explain why I don’t see any text other than the description.

            "alerts": [
            	{
            	"type": "HEA",
            	"description": "Excessive Heat Watch",
            	"date": "3:43 PM CDT on July 18, 2016",
            	"date_epoch": "1468874580",
            	"expires": "7:00 PM CDT on July 22, 2016",
            	"expires_epoch": "1469232000",
            	"tz_short":"CDT",
            	"tz_long":"America/Chicago",
            	"message": "\u000A...Excessive heat watch in effect from Wednesday morning through\u000AFriday evening...\u000A\u000AThe National Weather Service in Des Moines has issued an\u000Aexcessive heat watch...which is in effect from Wednesday morning\u000Athrough Friday evening. \u000A\u000A* Temperature...air temperatures in the mid to upper 90s, dewpoint\u000A temperatures in the mid to upper 70s, heat index values 105 to\u000A 115.\u000A\u000A* Impacts...excessive heat could lead to severe heat related\u000A illnesses and possibly death if proper action is not taken.\u000A\u000APrecautionary/preparedness actions...\u000A\u000AAn excessive heat watch means that a prolonged period of hot\u000Atemperatures is expected. The combination of hot temperatures and\u000Ahigh humidity will combine to create a dangerous situation in\u000Awhich heat illnesses are possible. Drink plenty of fluids...stay\u000Ain an air-conditioned room...stay out of the sun...and check up\u000Aon relatives and neighbors. Do not leave pets and/or children in \u000Aunattended vehicles.\u000A\u000A\u000AKotenberg\u000A\u000A\u000A\u000A",
            	"phenomena": "EH",
            	"significance": "A",
            	"ZONES": [
            	{
            	"state":"IA",
            	"ZONE":"004"
            	}
            

            !!! NWS Text begins here !!!

            Event: Excessive Heat Watch
            Alert:

            …EXCESSIVE HEAT LIKELY COMING TO IOWA WEDNESDAY INTO THIS
            WEEKEND…

            .CONFIDENCE FOR WEDNESDAY THROUGH FRIDAY IS HIGH TO VERY HIGH FOR
            HEAT INDEX VALUES ACROSS IOWA TO REACH THE 105 TO 115. HEAT INDEX
            VALUES OF 95 TO 100 DEGREES MAY LAST INTO AND THROUGHOUT THE
            WEEKEND.

            …EXCESSIVE HEAT WATCH IN EFFECT FROM WEDNESDAY MORNING THROUGH
            FRIDAY EVENING…

            THE NATIONAL WEATHER SERVICE IN DES MOINES HAS ISSUED AN
            EXCESSIVE HEAT WATCH…WHICH IS IN EFFECT FROM WEDNESDAY MORNING
            THROUGH FRIDAY EVENING.

            • TEMPERATURE…AIR TEMPERATURES IN THE MID TO UPPER 90S, DEWPOINT
              TEMPERATURES IN THE MID TO UPPER 70S, HEAT INDEX VALUES 105 TO
            • IMPACTS…EXCESSIVE HEAT COULD LEAD TO SEVERE HEAT RELATED
              ILLNESSES AND POSSIBLY DEATH IF PROPER ACTION IS NOT TAKEN.
              PRECAUTIONARY/PREPAREDNESS ACTIONS…

            AN EXCESSIVE HEAT WATCH MEANS THAT A PROLONGED PERIOD OF HOT
            TEMPERATURES IS EXPECTED. THE COMBINATION OF HOT TEMPERATURES AND
            HIGH HUMIDITY WILL COMBINE TO CREATE A DANGEROUS SITUATION IN
            WHICH HEAT ILLNESSES ARE POSSIBLE. DRINK PLENTY OF FLUIDS…STAY
            IN AN AIR-CONDITIONED ROOM…STAY OUT OF THE SUN…AND CHECK UP
            ON RELATIVES AND NEIGHBORS. DO NOT LEAVE PETS AND/OR CHILDREN IN
            UNATTENDED VEHICLES.

            RedNaxR 1 Reply Last reply Reply Quote 0
            • RedNaxR Offline
              RedNax Module Developer @Shockwave
              last edited by RedNax

              @Shockwave Well, it would seem WU is rather ‘loose’ with it’s API implementation…

              In your payload the full warning is in the message property. The Wunderground module expects is in the description property (only based on my observation of a single payload by my local station :S ). Ties in with your observation, which is always nice :)

              Watch this space for a fix…

              UPDATE: fix implemented… The module examines description and message lengths and uses the longest one… Have a go! :)

              S 1 Reply Last reply Reply Quote 0
              • S Offline
                Shockwave @RedNax
                last edited by

                @RedNax It works! Thanks for fixing that so fast. Now I need to politely bug MichMich about the size of the alert box since our weather service is so verbose. :)

                1 Reply Last reply Reply Quote 0
                • P Offline
                  Pauliolio @RedNax
                  last edited by paviro

                  @RedNax

                  That’s a handy test - Many thanks.
                  When I request:
                  http://api.wunderground.com/api/[my key]/conditions/forecast10day/astronomy/alerts/lang:EN/q/pws:IBATTLE3.json

                  I get a full set of data back.
                  The module is still getting stuck on ‘Loading’ on the mirror though.
                  My config is:

                  {
                      module: 'MMM-WunderGround',
                      position: 'top_right',
                      config:  {
                              apikey: '[my key]',
                              pws: 'IBATTLE3;loctype:1',
                              lang: 'EN',
                              fctext: '1',
                              fcdaycount: "5",
                              fcdaystart: "0",
                              hourly: '1',
                              hourlyinterval: "3",
                              hourlycount: "2",
                              alerttime: 10000,
                              alerttruncatestring: "english:"
                      }
                  },
                  

                  Can you see anything wrong there please?

                  Thank you.


                  Note from admin: Please use Markdown on code snippets for easier reading!

                  1 Reply Last reply Reply Quote 0
                  • P Offline
                    Pauliolio @RedNax
                    last edited by paviro

                    @RedNax

                    This may explain the issue to you hopefully. I thought I’d given you this info before, but it seems not.

                    In the console I get an error:
                    MMM-WunderGround.js:407 Uncaught TypeError: Cannot read property 'length' of undefined

                    The relevant code is:

                    	processWeather: function(data) {
                    		this.alerttext = "";
                    		this.alertmsg = "";
                    		for (var i = 0, count = data.alerts.length; i < count; i++) {
                    

                    Any idea why the array would be undefined?

                    Many thanks.


                    Note from admin: Please use Markdown on code snippets for easier reading!

                    RedNaxR 1 Reply Last reply Reply Quote 0
                    • RedNaxR Offline
                      RedNax Module Developer @Pauliolio
                      last edited by

                      @Pauliolio The issue is with the config. try the following change:

                      pws: 'pws:IBATTLE3',
                      
                      P 1 Reply Last reply Reply Quote 0
                      • yo-lessY Offline
                        yo-less Module Developer
                        last edited by

                        Hi @RedNax,
                        thanks for the excellent module! I seem to have some difficulty having night time icons displayed. I’m not sure what I’m doing wrong as this is what my module looks like at 1 am in the morning:

                        0_1469055256185_nighttime.png

                        Using the API in my browser window I get the following two lines:

                        “icon”:“clear”,
                        “icon_url”:“http://icons.wxug.com/i/c/k/nt_clear.gif”

                        It seems to me that I’m getting the daytime “clear” condition icon, maybe due to the ambiguous icon declaration, anything I can do to change icons like this one to nighttime icons?

                        1 Reply Last reply Reply Quote 0
                        • RedNaxR Offline
                          RedNax Module Developer
                          last edited by RedNax

                          Easiest way to do this is to define another icontable for nighttime use and switching to it after sunset…

                          When i have some time, i’ll look into it…

                          UPDATE: Who am i kidding ;) Nighttime icons now included…

                          yo-lessY 1 Reply Last reply Reply Quote 1
                          • M Offline
                            murattyilmaz
                            last edited by

                            Where is the github url or download url of these module? Can’t find it.

                            KirAsh4K 1 Reply Last reply Reply Quote 0
                            • KirAsh4K Offline
                              KirAsh4 Moderator @murattyilmaz
                              last edited by

                              @murattyilmaz,

                              You need to look under the Showcase category to find the actual link. This category here is the Troubleshooting side of those modules.

                              https://forum.magicmirror.builders/topic/128/weatherunderground-currently-hourly-daily-configurable

                              A Life? Cool! Where can I download one of those from?

                              1 Reply Last reply Reply Quote 0
                              • P Offline
                                Pauliolio @RedNax
                                last edited by

                                @RedNax

                                Hi - I’d already tried that unfortunately. Still gets stuck at the same point in the code & displaying ‘Loading’ on the screen.

                                Would wrapping that for loop in an if that checks whether data.alerts is actually defined or a try block help do you think?

                                RedNaxR 1 Reply Last reply Reply Quote 0
                                • RedNaxR Offline
                                  RedNax Module Developer @Pauliolio
                                  last edited by RedNax

                                  Hi!

                                  The alerts array is always there, even when there’s zero items in it. The behaviour you’re seeing is only possible if/when the api errors out and doesn’t send a meaningful payload. Could build a check for that…

                                  Could it be BATTLE3 goes offline at times? When using the earlier mentiond config setting, it works just fine here… (there was a flod warning if i remember correctly)…

                                  1 Reply Last reply Reply Quote 0
                                  • yo-lessY Offline
                                    yo-less Module Developer @RedNax
                                    last edited by yo-less

                                    @RedNax
                                    You, sir, are amazing :). Thanks, man, I just checked this thread to see if there were any more ideas on how to get night-time weather icons to appear and have only just now seen that you have already fixed my problem!! Thanks for this amazing update, at this stage I’m only good at fiddling with code that has already been written, but I’m not good enough myself to add in an icon table change based on the time of day.

                                    For some weird reason, in the css file the night-time clear icon is defined as “wi-nt-clear” and not as wi-night-clear" , you need to change that in your code to make the night-time clear icon appear (or change it in the css file, which is what I did in my configuration).

                                    Funnily enough, this is what happens now once you change that and check out the mirror after sundown (the forecast starts using the night icons):

                                    0_1470610163794_forecast-icons.png

                                    I was able to fix this behaviour myself, first I attacked line 461

                                    	this.iconTableHeader = (sunrise < now && sunset > now) ? this.config.iconTableDay : this.config.iconTableNight;
                                    	this.iconTable = this.config.iconTableDay;
                                    

                                    This is what I did to line 490:

                                    	this.weatherTypeHeader = this.iconTableHeader[data.current_observation.icon];
                                    	this.weatherType = this.iconTable[data.current_observation.icon];
                                    

                                    Finally, I changed line 178 to:

                                    	weatherIcon.className = "wi weathericon " + this.weatherTypeHeader;
                                    

                                    Not sure if this is the best way of implementing a fix, but this seems to have resolved the issues I was facing :).

                                    0_1470610827538_forecast-icons-now.png

                                    I’m all happy now, thanks again, love your modifications to the module which have allowed me to add in some modifications of my own. I suppose there is a way to somehow upload my changes to github to suggest some changes to the developer but since I’m pretty much a newbie at this stage, I have no idea how ^^.

                                    So, all’s well, right? Well… :D

                                    I noticed that the weather-icons set has different icons depending on the current moon phase. Could you point me in the right direction as to what code I would have to add in to pull this information from the wunderground.com API?Maybe I could manage to have the mirror only show the full-moon night-time icons when there actually is a full moon outside.

                                    EDIT:
                                    I realized there are more icons that I would change in the icon table, here’s my version:

                                    	iconTableNight: {                        
                                            "chanceflurries": "wi-night-snow-wind",
                                            "chancerain": "wi-night-showers",
                                            "chancesleet": "wi-night-sleet",
                                            "chancesnow": "wi-night-alt-snow",
                                            "chancetstorms": "wi-night-alt-storm-showers",
                                            "clear": "wi-stars",
                                            "cloudy": "wi-night-alt-cloudy",
                                            "flurries": "wi-night-alt-snow-wind",
                                            "fog": "wi-night-fog",
                                            "haze": "wi-night-alt-cloudy-windy",
                                            "mostlycloudy": "wi-night-alt-cloudy",
                                            "mostlysunny": "wi-night-alt-partly-cloudy",
                                            "partlycloudy": "night-alt-partly-cloudy",
                                            "partlysunny": "wi-night-alt-partly-cloudy",
                                            "rain": "wi-night-alt-rain",
                                            "sleet": "wi-night-alt-sleet",
                                            "snow": "wi-night-alt-snow",
                                            "tstorms": "wi-night-alt-thunderstorm"
                                    	},
                                    
                                    yo-lessY 1 Reply Last reply Reply Quote 0
                                    • yo-lessY Offline
                                      yo-less Module Developer @yo-less
                                      last edited by

                                      @yo-less said in Weatherunderground - currently - hourly - daily - configurable:

                                      EDIT:
                                      I realized there are more icons that I would change in the icon table, here’s my version:

                                      In fact, it should look like this -> ( changed “night-alt-partly-cloudy” to "“wi-night-alt-partly-cloudy”)

                                      iconTableNight: {                        
                                              "chanceflurries": "wi-night-snow-wind",
                                              "chancerain": "wi-night-showers",
                                              "chancesleet": "wi-night-sleet",
                                              "chancesnow": "wi-night-alt-snow",
                                              "chancetstorms": "wi-night-alt-storm-showers",
                                              "clear": "wi-night-clear",
                                              "cloudy": "wi-night-alt-cloudy",
                                              "flurries": "wi-night-alt-snow-wind",
                                              "fog": "wi-night-fog",
                                              "haze": "wi-night-alt-cloudy-windy",
                                              "mostlycloudy": "wi-night-alt-cloudy",
                                              "mostlysunny": "wi-night-alt-partly-cloudy",
                                              "partlycloudy": "wi-night-alt-partly-cloudy",
                                              "partlysunny": "wi-night-alt-partly-cloudy",
                                              "rain": "wi-night-alt-rain",
                                              "sleet": "wi-night-alt-sleet",
                                              "snow": "wi-night-alt-snow",
                                              "tstorms": "wi-night-alt-thunderstorm"
                                      	},
                                      
                                      1 Reply Last reply Reply Quote 0
                                      • yo-lessY Offline
                                        yo-less Module Developer
                                        last edited by

                                        Alright, I have noticed one more issue. With the current code the sun shines all throughout the night in the hourly forecasts:

                                        0_1470678948573_hourly-forecasts-old.png

                                        I have written some code to fix it so that it looks like this instead:

                                        0_1470678980956_hourly-forecasts.png

                                        Here is what I did to lines 552 - 563 in MMM-WunderGround.js ->

                                        		var hourlyTime = new Date();
                                        		hourlyTime.setHours(hourlyforecast.FCTTIME.hour,00,00);
                                        		
                                        		if (hourlyTime > sunset || hourlyTime < sunrise) {
                                        						
                                        		this.hourlyforecast.push({
                                        
                                        			hour:    this.thour,
                                        			maxTemp: this.tmaxTemp,
                                        			minTemp: this.tminTemp,
                                        			icon:    this.config.iconTableNight[forecast.icon],
                                        			pop:	 hourlyforecast.pop,
                                        			mm:	 this.tmm
                                        		});
                                        		
                                        		} else {
                                        						
                                        		this.hourlyforecast.push({
                                        
                                        			hour:    this.thour,
                                        			maxTemp: this.tmaxTemp,
                                        			minTemp: this.tminTemp,
                                        			icon:    this.config.iconTableDay[forecast.icon],
                                        			pop:	 hourlyforecast.pop,
                                        			mm:	 this.tmm
                                        		}); 
                                        		}
                                        	}
                                        	}
                                        

                                        Again, I’m not sure if this can be done more efficiently, I’m happy to be pointed in a better direction :). But for now, everything seems to be just fine.

                                        1 Reply Last reply Reply Quote 0
                                        • yo-lessY Offline
                                          yo-less Module Developer
                                          last edited by

                                          My bad, code should have been:

                                          	var hourlyTime = new Date();
                                          	hourlyTime.setHours(hourlyforecast.FCTTIME.hour,00,00);
                                          	
                                          	if (hourlyTime > sunset || hourlyTime < sunrise) {
                                          					
                                          	this.hourlyforecast.push({
                                          
                                          		hour:    this.thour,
                                          		maxTemp: this.tmaxTemp,
                                          		minTemp: this.tminTemp,
                                          		icon:    this.config.iconTableNight[hourlyforecast.icon],
                                          		pop:	 hourlyforecast.pop,
                                          		mm:	 this.tmm
                                          	});
                                          	
                                          	} else {
                                          					
                                          	this.hourlyforecast.push({
                                          
                                          		hour:    this.thour,
                                          		maxTemp: this.tmaxTemp,
                                          		minTemp: this.tminTemp,
                                          		icon:    this.config.iconTableDay[hourlyforecast.icon],
                                          		pop:	 hourlyforecast.pop,
                                          		mm:	 this.tmm
                                          	}); 
                                          	}
                                          }
                                          }
                                          
                                          1 Reply Last reply Reply Quote 0
                                          • RedNaxR Offline
                                            RedNax Module Developer
                                            last edited by

                                            Hi,

                                            Thanks for debugging :D Added (a version) of this in the develop branch!

                                            yo-lessY 1 Reply Last reply Reply Quote 0

                                            Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                                            Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                                            With your input, this post could be even better 💗

                                            Register Login
                                            • 1
                                            • 2
                                            • 3
                                            • 4
                                            • 5
                                            • 6
                                            • 7
                                            • 1 / 7
                                            • First post
                                              Last post
                                            Enjoying MagicMirror? Please consider a donation!
                                            MagicMirror created by Michael Teeuw.
                                            Forum managed by Sam, technical setup by Karsten.
                                            This forum is using NodeBB as its core | Contributors
                                            Contact | Privacy Policy