scottcl88 / MMM-DynamicWeather

A heavily configurable MagicMirror Module to display different animations based on current weather and show customized event effects.
MIT License
30 stars 7 forks source link

Animation Gets Stuck on Rain/Snow Instead of Stopping When Clouds/Sun are Disabled #40

Closed ben3636 closed 3 years ago

ben3636 commented 3 years ago

So I have hideSun, hideClouds, and hideFog set to true because I just want to see when it is raining or snowing and it works until it stops raining/snowing. The expected behavior is that once the weather goes from rain/snow back to cloudy/sunny/foggy (one of the disabled effects) that all effects would just stop. Instead it keeps raining or snowing instead of stopping the effect. I expect the rain or snow to just stop and not display any animation when the weather changes back to one of the disabled effects (sun/cloudy/foggy) but instead it keeps the previous one going. I have tried everything in the troubleshooting and cannot seem to fix the issue. I can confirm that removing the hideSun/hideClouds/hideFog entries resolve the issue and it is not a problem with the API so it is definitely related to how the program deals with the disabled effects. I also glanced through the code and it seems that it just checks if the hideSun, etc values are not set. If they are not, it starts the animation, but if the hideSun, etc values are set I don't see anywhere that runs the stopEffect. This would explain why it doesn't stop the current effect if the new weather effect is disabled and just keeps the current one running. I'm not too good with JavaScript but that's what it looked like to me. Thanks in advance!

Config:

            {
                    module: 'MMM-DynamicWeather',
                    position: 'fullscreen_above',
                    config: { // See https://github.com/scottcl88/MMM-DynamicWeather for more information.
                            api_key: "ABCDEFG",
                            hideSun: true,
                            hideFog: true,
                            effectDuration: "480000",
                            effectDelay: "1",
                            fadeDuration: "3000",
                            weatherInterval: "600000",
                            locationID: "5234372"
                            lat: "44.474044",
                            lon: "-73.213592",
                            hideClouds: true
                           }
scottcl88 commented 3 years ago

@ben3636 Thanks for reporting this issue and all the included information. I believe I have fixed it with the latest update v2.14.1; it was a simple change so that whenever the API gets a new code we should always update the global weatherCode when the next dom update occurs. This previously only happened when a weather effect was to be displayed.