• Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
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.

Can I round Precipitation Units

Scheduled Pinned Locked Moved Solved Troubleshooting
5 Posts 4 Posters 637 Views 5 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.
  • A Offline
    amarko87
    last edited by Mar 16, 2022, 7:58 PM

    Hey all,

    Just curious if I’m able to round the showPrecipitationAmount units like I can with Temp units. I feel like there’s a way, but without a specific line in the documentation I didn’t want to start poking around since I know so little about coding in general. I’m a woodworker so this is all pretty new to me.

    Thanks

    S 1 Reply Last reply Mar 16, 2022, 8:17 PM Reply Quote 0
    • K Offline
      kayakbabe
      last edited by kayakbabe Sep 10, 2022, 4:40 AM Sep 10, 2022, 4:34 AM

      I figured it out. I wanted to round it off too. No decimal places.
      You have to edit the template files. look for the showPrecipitationAmount if statement. I altered the output a little bit… see below for what I did.

      in forecast.njk

                      {% if config.showPrecipitationAmount %}
                          {% if f.precipitationUnits %}
                              <td class="align-right bright precipitation">
                                  {{ f.precipitation }}{{ f.precipitationUnits }}
                              </td>
      		                {% else %}
                              {% if f.pop %}
                                  <td class="align-right precipitation">
                                      {{(f.pop * 100).toFixed(0)}}%
                                  </td>
                              {% endif %}
                              <td class="align-right bright precipitation">
                                  {{ f.precipitation | unit("precip") }}
                              </td>
                          {% endif %}
                      {% endif %}
      

      I found info on the templates by googling nunchucks templates.

      1 Reply Last reply Reply Quote 0
      • S Offline
        sdetweil @amarko87
        last edited by Mar 16, 2022, 8:17 PM

        @amarko87 what module are you talking about ?

        Sam

        How to add modules

        learning how to use browser developers window for css changes

        A 1 Reply Last reply Mar 16, 2022, 8:43 PM Reply Quote 0
        • A Offline
          amarko87 @sdetweil
          last edited by Mar 16, 2022, 8:43 PM

          @sdetweil I probably should’ve mentioned that in the post. Just the default Weather module.

          C 1 Reply Last reply Mar 20, 2022, 2:55 PM Reply Quote 0
          • C Offline
            crazylegs @amarko87
            last edited by Mar 20, 2022, 2:55 PM

            @amarko87 There’s currently no option to round precipitation amount in the default Weather module, although I think this should be possible. I’m just curious:

            • Which weather provider are you using?

            • Are you looking for rounding in the ‘forecast’ and/or ‘hourly’ feature of the Weather module?

            1 Reply Last reply Reply Quote 0
            • K Offline
              kayakbabe
              last edited by kayakbabe Sep 10, 2022, 4:40 AM Sep 10, 2022, 4:34 AM

              I figured it out. I wanted to round it off too. No decimal places.
              You have to edit the template files. look for the showPrecipitationAmount if statement. I altered the output a little bit… see below for what I did.

              in forecast.njk

                              {% if config.showPrecipitationAmount %}
                                  {% if f.precipitationUnits %}
                                      <td class="align-right bright precipitation">
                                          {{ f.precipitation }}{{ f.precipitationUnits }}
                                      </td>
              		                {% else %}
                                      {% if f.pop %}
                                          <td class="align-right precipitation">
                                              {{(f.pop * 100).toFixed(0)}}%
                                          </td>
                                      {% endif %}
                                      <td class="align-right bright precipitation">
                                          {{ f.precipitation | unit("precip") }}
                                      </td>
                                  {% endif %}
                              {% endif %}
              

              I found info on the templates by googling nunchucks templates.

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