I’ve created a module that displays the local sunrise, sunset and solar noon times. maybe it’ll be useful for people.
Any offers to make it better are gratefully received!
[card:prydonian/MMM-Sunrise-Sunset]
I’ve created a module that displays the local sunrise, sunset and solar noon times. maybe it’ll be useful for people.
Any offers to make it better are gratefully received!
[card:prydonian/MMM-Sunrise-Sunset]
@mrdenmark it appears that the API doesn’t like the Southern Hemisphere…
http://api.sunrise-sunset.org/json?lat=-44.57&lng=168.50&date=today
Is that config exactly as it appears in your config file? layout should be all lowercase.
@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.
@henry2man the API is limited to 1000 calls per day. It doesn’t appear to expire after a day.
Can you post the config for the module?
it should look like this:
{
module: "MMM-Sunrise-Sunset",
position: "bottom_bar",
config: {
apiKey: "API_KEY",
latitude: "123.123",
longitude: "23.456",
layout: "inline"
}
},
https://github.com/prydonian/MMM-Sunrise-Sunset
Made a fairly big update using a different API that needs a free key.
https://ipgeolocation.io/signup.html
It now gives you moonrise and moonset times and day length.
(eg: @import url(‘https://fonts.googleapis.com/css?family=Open+Sans+Condensed:300,700|Open+Sans:400,700&display=swap’);)
use the @import method in custom.css and change the font declarations in
body
.thin
.light
.regular
.bold
header
from (example)
font-family: “Roboto Condensed”, sans-serif;
to
font-family: “Open Sans Condensed”, “Roboto Condensed”, sans-serif;
As long as the information can be put in the top level and made available to modules without having to repeat common variables over and over again in individual module configs, I don’t mind how it’s done.
@sdetweil Think I did that right. Hope someone can make it work.
I’ve noticed a lot of modules want your latitude, longitude, and other info that gets repeated across various configs. It would make sense to have a global section where this can be defined once and then made available to all modules.
e.g.:
var config = {
address: "localhost",
port: 8080,
ipWhitelist: ["127.0.0.1", "::ffff:127.0.0.1", "::1"],
customCss: "css/custom.css",
language: "en",
timeFormat: 24,
units: "metric",
latitude: "51.1",
longitude: "0.1",
timezone: "Europe/London",
modules: [
...
]
};
@mrdenmark if you update the module now, it should account for the timezone if you set it in your config. From your latitude/longitude, yours (I think) would be “Pacific/Auckland”.
Try this:
{
module: "MMM-Sunrise-Sunset",
position: "top_left",
config: {
latitude: "-44.57",
longitude: "168.50",
timezone: "Pacific/Auckland",
layout: "list"
}
},
@mrdenmark the API returns all dates in UTC, so I may look at putting a time zone offset option in the config, or if you feel confident doing that yourself, feel free to try.