Read the statement by Michael Teeuw here.
MMM-Sunrise-Sunset
-
I removed the config but seemed like yours. I followed the README from master. I’ll try again later, but also I’ve reviewed this API
https://api.sunrise-sunset.org/json?lat=36.7201600&lng=-4.4203400&formatted=0
It has enough information and seems to be free.
What do you think?
-
@henry2man that’s the one I was using before, but it required a lot of work to get the time in your local time zone as all times were returned as UTC.
The new API uses your location to format the time automatically.
-
@vbloke In this link there is a simple way to get a ISO 8601 into your local timezone --> https://stackoverflow.com/a/31453408
var utcDate = '2011-06-29T16:52:48.000Z'; // ISO-8601 formatted date returned from server var localDate = new Date(utcDate);
api.sunrise-sunset.org can return ISO 8601 dates using
formatted=0
parameter…
If date parsing is the major issue & this solution works I think this approach is simpler. Even you can default the URL and simply configure lat/long & style (inline/list)
Just my 2 cents…
-
This is right out of my MMM-SunRiseSet module.
Feel free to use it if you like. :thumbsup:
// sunrise set to local time using moment var sunrise = document.createElement("div"); sunrise.classList.add("small", "bright", "sunrise"); sunrise.innerHTML = "Sunrise is at " + moment(SunRiseSet.sunrise).local().format("h:mm a") + "     " + "Sunset is at " + moment(SunRiseSet.sunset).local().format("h:mm a"); wrapper.appendChild(sunrise);
-
@henry2man
I am having the same problem, whenever I put it in my config the display is blank. -
@pugsly not in config… you have to edit the actual module code
-
@sdetweil Not sure I know what you mean. When I put this in my config the screen is all blank:
{ module: "MMM-Sunrise-Sunset", position: "top_right", header: "Sunrise", config: { latitude: "39.2907", longitude: "-75.6344", apikey: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", layout: "inline" } },
-
@pugsly open the developers window on your blank screen MM, using ctrl-shift-i on the keyboard… select the tab labeled console and scroll up to find any errors
-
Uncaught ReferenceError: $ is not defined
at Class.updateSun (MMM-Sunrise-Sunset.js:33)
at Class.start (MMM-Sunrise-Sunset.js:12)
at startModules (loader.js:55)
at loader.js:40
at HTMLLinkElement.stylesheet.onload (loader.js:200) -
@pugsly said in MMM-Sunrise-Sunset:
Uncaught ReferenceError: $ is not defined
this module depends on jquery library being installed for this module, but its not…,
I am working on instructions for you… hang on
do
cd ~/MagicMirror/modules/MMM-Sunrise-Sunset npm install jquery # note the trailing dot (.) on the next line cp node_modules/jquery/dist/jquery.js .
then start your mirror again