I created a module that displays active weather alerts from the openWeatherMap ‘onecall’ API.
Screenshot
Details and Usage: MMM-WeatherAlerts
I created a module that displays active weather alerts from the openWeatherMap ‘onecall’ API.
Screenshot
Details and Usage: MMM-WeatherAlerts
@JohnGalt appreciate the update.
For the module interference while no alerts are active, good eye. This is caused by the default “margin-bottom” that MagicMirror gives to each module. The result is that when no alerts are visible, the module takes up no space, but its margin is still pushing surrounding modules to create the undesired effect that you observed.
I have a quick (slightly-hacky) solution. In your “custom.css” file, add the following:
.MMM-WeatherAlerts {
margin-bottom: 0px;
}
That should clean up the impact on your default weather modules. The side effect of this is that when there are alerts active, they will be stacked more tightly on-top of one another. I will look and see if I can find a robust way of handling this styling issue so that the spacing is included when the alerts are active and the spacing is “off” when there are no alerts to show. The trick here is that the spacing (margin-bottom) is set by the main app, and not by my module so it may take some work to implement a good solution.
FYI, on my mirror I have the alert module at the bottom of my default weather modules so it avoids this issue all together. Just another option…
@JohnGalt unable to replicate this issue. I setup my computer as MagicMirror server and then I am able to access the server from my computer’s web-browser and from my raspberry pi acting as a client with both displays showing as expected.
Am I misunderstanding your current configuration? Did you happen to set the ‘alertDateFormat’ parameter in your configuration as well?
@croc_dad72 I tried that lat and lon and I am seeing the winter weather advisory.
Let me ask this: For the other weather modules (e.g. forecast), are you setting an apiVersion parameter in your config file? If yes, to what?
Lastly, are you able to share your config layout for the MMM-WeatherAlerts module, minus your apiKey? I’m expecting something like this:
{
module: "MMM-WeatherAlerts",
position: "top_right",
header: "Weather Alerts",
config: {
lat: "42.4604",
lon: "-71.3489",
colored: true,
alertTimeFormat: "absolute",
}
},
@croc_dad72 If your API key is for version 3.0 of the API, then yes you would need to subscribe to their onecall API to be able to receive alert data. Unfortunate that they changed the onecall model to subscriber based.
@croc_dad72 The module will only be visible if an alert is active for the given lat/lon. Are you expecting an active weather alert for the location you are using? If yes, can you share a lat/lon and I would be happy to investigate further?
Here is a lat/lon that currently has an active alert and the module appears with the relevant alerts; you can use these as a test:
lat: "38.93323"
lon: "-119.98435"
@JohnGalt Thanks for checking out my module.
With regard to your question of “what constitutes an alert that will trigger the module”: the answer is any alert that is provided by the openWeatherMap one-call API. As far as “what alerts are provided by openWeatherMap”, the details are shared on their website in the section linked here. They list the following reporting agencies for the US:
I verified the behavior that you described for the lan and lon you provided. Upon further investigation, it looks like the module is performing properly, but there is no alert coming from the OpenWeatherMap API.
I am sending the OpenWeatherMap team an email with the details of the NWS Blizzard Warning and lack of a corresponding alert data from their API. I will let you know if I hear a reply.
From the testing I have done previously, it looks like the NWS has different regions that are responsible for sending their own alerts. There may be an outage from the Alaska region, specifically National Weather Service Fairbanks AK.
Unrelated to this issue, I noticed that you have the module position set to “bottom-bar”. I hadn’t tested that position until just now and the styling is not optimized for that location. I’m going to see about fixing that.
I created a module that displays active weather alerts from the openWeatherMap ‘onecall’ API.
Screenshot
Details and Usage: MMM-WeatherAlerts