MMM-Snow icon indicating copy to clipboard operation
MMM-Snow copied to clipboard

Run Snow if weather snowy

Open emrahaslan opened this issue 4 years ago • 8 comments

Not Issue.

Is It possible to run this module only if current weather is snowy ?

emrahaslan avatar Sep 03 '20 22:09 emrahaslan

+1 searching for this feature ^^ I just thought about the same idea...

Black-Zero avatar Jan 26 '21 17:01 Black-Zero

This is answered here: https://forum.magicmirror.builders/topic/1232/mmm-snow-yet-another-snow-module/14

Basically, you can use MMM-Remote-Control to show & hide the module. You need some device though to check upon the weather & call the HTTP GET addresses.

Jessendelft avatar Jan 27 '21 21:01 Jessendelft

This is answered here: https://forum.magicmirror.builders/topic/1232/mmm-snow-yet-another-snow-module/14

Basically, you can use MMM-Remote-Control to show & hide the module. You need some device though to check upon the weather & call the HTTP GET addresses.

Thank you for your hint :)

Black-Zero avatar Jan 27 '21 23:01 Black-Zero

I made a solution:

Current Weather

schrammalama avatar Feb 02 '21 22:02 schrammalama

My previous post was flawed, the script to get value of 'description' was running before the openweathermap api changed the value, resulting in it always running hide, even if there is snow. Here is the change made:

This was moved from a separate function to be a part of the drawWeather function so it could pull directly from the json data instead of from an .innerHTML value:

if (d.weather[0].description == "light snow") { var wnd = window.open("http://"Remote control ip address":8080/api/module/MMM-Snow/show"); setTimeout(function() { wnd.close(); }, 5000); } else { var wnd = window.open("http://Remote control ip address" :8080/api/module/MMM-Snow/hide"); setTimeout(function() { wnd.close(); }, 5000); }

Here is the final code: Snow.txt

schrammalama avatar Feb 03 '21 18:02 schrammalama

Hello,

thank you schrammalama for your effort. May I ask you, how I should integrate this code into my MagicMirror?

Thank you very much!

Black-Zero avatar Feb 05 '21 10:02 Black-Zero

It is an html page, run mm is one workspace then run the page in another workplace, if you run it in the same workplace it will come in front of the mm whenever it refreshes

schrammalama avatar Feb 05 '21 17:02 schrammalama

also i am working on working the code into the module, once finished i will put it up on the module list page and all you will have to do is install the module

https://github.com/schrammalama/MMM-Snow-Automatic

schrammalama avatar Feb 05 '21 17:02 schrammalama