MichMich / MMM-Snow

54 stars 16 forks source link

Run Snow if weather snowy #6

Open emrahaslan opened 3 years ago

emrahaslan commented 3 years ago

Not Issue.

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

Black-Zero commented 3 years ago

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

Jessendelft commented 3 years ago

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.

Black-Zero commented 3 years ago

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 :)

schrammalama commented 3 years ago

I made a solution: <!doctype html>

Current Weather

schrammalama commented 3 years ago

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

Black-Zero commented 3 years ago

Hello,

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

Thank you very much!

schrammalama commented 3 years ago

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 commented 3 years ago

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