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.

    MMM-BM-OW when 'no rain' for forecast undefined message received.

    Scheduled Pinned Locked Moved Troubleshooting
    14 Posts 3 Posters 3.3k Views 3 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.
    • Mykle1M Offline
      Mykle1 Project Sponsor Module Developer @scumbelly
      last edited by

      @scumbelly

      Just to be clear, the module works but not after you modified it?

      Create a working config
      How to add modules

      1 Reply Last reply Reply Quote 0
      • S Offline
        scumbelly
        last edited by

        Hi,

        The module works just fine. It’s only when you do not receive a forecasted rain amount . So if Tuesday has 2 returned ( for mm of rain) and Wednesday has no rain then Wednesday displays undefined as a value.

        The code is …

        moment.unix(forecast.daily[X].sunrise).local().format(‘ddd’) + " &nbsp" + “<img class = image src=./modules/MMM-BMW-OW/icons/” + forecast.daily[X].weather[0].main + “.png>” + " &nbsp" + Math.round(forecast.daily[X].temp.max) + “/” + Math.round(forecast.daily[X].temp.min) + " &nbsp &nbsp &nbsp &nbsp &nbsp" + forecast.daily[X].rain + “/mm Rain” + “&nbsp &nbsp &nbsp &nbsp &nbsp”+ until 6 terminates with no + but with ;

        Hope that helps.

        is 0 to 6.

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

          That check mark is supposed to be X for 0 to 6.

          1 Reply Last reply Reply Quote 0
          • S Offline
            scumbelly
            last edited by

            Hi,

            I changed the string a bit. I added Math.round to forecast.daily[X].rain + “/mm Rain”

            Math.round (forecast.daily[X].rain) + “/mm Rain”

            and instead of undefind/mm Rain I now receive NaN/mm Rain.

            Cool.

            cowboysdudeC 1 Reply Last reply Reply Quote 0
            • cowboysdudeC Offline
              cowboysdude Module Developer @scumbelly
              last edited by cowboysdude

              @scumbelly this needs some css help but… is this what you’re after?
              Capture.PNG

              S 1 Reply Last reply Reply Quote 1
              • S Offline
                scumbelly @cowboysdude
                last edited by

                @cowboysdude

                Exceptional. That’s it! What’s the solution? I started to go down an isNAN() rabbit hole but as yet haven’t been successful.

                Great job.

                cowboysdudeC 1 Reply Last reply Reply Quote 0
                • cowboysdudeC Offline
                  cowboysdude Module Developer @scumbelly
                  last edited by

                  @scumbelly It takes rewriting parts of the entire module to make it work…

                  Mykle1M 1 Reply Last reply Reply Quote 0
                  • S Offline
                    scumbelly
                    last edited by

                    @cowboysdude

                    I don’t know if I’m headed in the right way but I’ve tried to make showRain a config option - true/false.

                    Right now it kinda loads - at least I get Openweather data… on the screen instead of a blank “dead zone”.

                    Gotta play more… Gotta learn more.

                    Cheers

                    cowboysdudeC 1 Reply Last reply Reply Quote 0
                    • Mykle1M Offline
                      Mykle1 Project Sponsor Module Developer @cowboysdude
                      last edited by

                      @cowboysdude said in MMM-BM-OW when 'no rain' for forecast undefined message received.:

                      It takes rewriting parts of the entire module to make it work…

                      Uhhhh . . .

                      Create a working config
                      How to add modules

                      1 Reply Last reply Reply Quote 0
                      • cowboysdudeC Offline
                        cowboysdude Module Developer @scumbelly
                        last edited by

                        @scumbelly Have at it… it’s how you learn.

                        S 1 Reply Last reply Reply Quote 0
                        • 1
                        • 2
                        • 1 / 2
                        • 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