-
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Switched to Rollup; Used deftype definitions; Add severe color (#4)
* Switched to Rollup; Used deftype definitions; Add severe color * minor Co-authored-by: Jan Litzenburger <jan.litzenburger@sap.com>
- Loading branch information
Showing
17 changed files
with
648 additions
and
2,257 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,4 @@ | ||
{ | ||
"extends": ["airbnb-typescript-prettier"], | ||
"ignorePatterns": ["*.js"], | ||
"rules": { | ||
"padding-line-between-statements": "error", | ||
"comma-dangle": 0, | ||
"prettier/prettier": "error", | ||
"no-unused-vars": "error", | ||
"prefer-template": "warn", | ||
"import/no-extraneous-dependencies": ["error", { "devDependencies": true }] | ||
} | ||
"ignorePatterns": ["*.js"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
{ | ||
"jsxBracketSameLine": true, | ||
"semi": false, | ||
"singleQuote": true, | ||
"trailingComma": "none", | ||
"endOfLine": "auto", | ||
"printWidth": 120 | ||
} | ||
"jsxBracketSameLine": true, | ||
"semi": false, | ||
"singleQuote": true, | ||
"trailingComma": "none", | ||
"endOfLine": "auto", | ||
"printWidth": 120 | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,14 @@ | ||
Module.register("MMM-NINA",{defaults:{updateIntervalInSeconds:120,maxAgeInHours:6,ags:"110000000000",showNoWarning:!1},getStyles:()=>["font-awesome.css","MMM-NINA.css"],getScripts:function(){return["moment.js"]},getTranslations:()=>({en:"translations/en.json",de:"translations/de.json"}),getTemplate:()=>"templates/MMM-NINA.njk",getTemplateData(){return{config:this.config,alerts:this.alerts}},start(){this.loadData(),this.scheduleUpdate(),this.updateDom()},scheduleUpdate(){const t=this;setInterval((()=>{t.loadData()}),1e3*this.config.updateIntervalInSeconds)},loadData(){this.sendSocketNotification("GET_NINA_ALERTS",this.config)},socketNotificationReceived(t,e){"NINA_ALERTS_RESPONSE"===t&&(this.alerts=e.map((t=>(t.date=moment(new Date(t.sent)).format("DD.MM.YYYY - HH:mm"),t))),this.updateDom(),console.debug("Alerts",this.alerts))}}); | ||
/*! ***************************************************************************** | ||
mmm-nina | ||
Version 1.0.0 | ||
Simple Client Implementierung für die NINA Warn App für die MagicMirror² Plattform. | ||
Please submit bugs at https://github.com/jalibu/MMM-NINA/issues | ||
(c) Jan.Litzenburger@gmail.com | ||
Licence: MIT | ||
This file is auto-generated. Do not edit. | ||
***************************************************************************** */ | ||
|
||
!function(){"use strict";Module.register("MMM-NINA",{defaults:{updateIntervalInSeconds:120,maxAgeInHours:6,ags:"110000000000",showNoWarning:!1},getStyles:()=>["font-awesome.css","MMM-NINA.css"],getScripts:function(){return["moment.js"]},getTranslations:()=>({en:"translations/en.json",de:"translations/de.json"}),getTemplate:()=>"templates/MMM-NINA.njk",getTemplateData(){return{config:this.config,alerts:this.alerts}},start(){this.loadData(),this.scheduleUpdate(),this.updateDom()},scheduleUpdate(){const t=this;setInterval((()=>{t.loadData()}),1e3*this.config.updateIntervalInSeconds)},loadData(){this.sendSocketNotification("GET_NINA_ALERTS",this.config)},socketNotificationReceived(t,e){"NINA_ALERTS_RESPONSE"===t&&(this.alerts=e.map((t=>(t.date=moment(new Date(t.sent)).format("DD.MM.YYYY - HH:mm"),t))),this.updateDom(),console.debug("Alerts",this.alerts))}})}(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,61 @@ | ||
# MMM-NINA | ||
[![Known Vulnerabilities](https://snyk.io/test/github/jalibu/MMM-NINA/badge.svg?targetFile=package.json)](https://snyk.io/test/github/jalibu/MMM-NINA?targetFile=package.json) | ||
# MMM-NINA - Ein NINA Warn-App Client für den Magic Mirror | ||
|
||
Dies ist eine simple Client Implementierung der NINA Warn-App für die [MagicMirror²](https://magicmirror.builders/) Platform. | ||
Feedback willkommen. | ||
[![dependencies Status](https://status.david-dm.org/gh/jalibu/MMM-NINA.svg)](https://david-dm.org/jalibu/MMM-NINA) [![Known Vulnerabilities](https://snyk.io/test/github/jalibu/MMM-NINA/badge.svg?targetFile=package.json)](https://snyk.io/test/github/jalibu/MMM-NINA?targetFile=package.json) | ||
|
||
EIne simple Client Implementierung der NINA Warn App API für die [MagicMirror²](https://magicmirror.builders/) Plattform. | ||
Klicke hier für den [Forum Thread](https://forum.magicmirror.builders/topic/15429/mmm-nina) | ||
|
||
Feedback und Mithilfe willkommen. | ||
|
||
### Support | ||
Wenn du meine Arbeit schätzt, dann freue ich mich über ein Star-Rating oder einen bescheidenen Beitrag zu meinem nächsten Feierabend-Bier :-) | ||
|
||
Wenn du meine Arbeit schätzt, dann freue ich mich über einen bescheidenen Beitrag zu meinem nächsten Feierabend-Bier. | ||
|
||
<a href="https://www.buymeacoffee.com/jalibu" target="_blank"><img src="https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png" alt="Buy Me A Beer" style="height: 45px !important;width: 180px !important;" ></a> | ||
|
||
## Features | ||
* Das Modul ruft periodisch die NINA API auf und ermittelt Warnmeldungen für deinen Kreis. | ||
|
||
- Das Modul ruft periodisch die NINA API auf und ermittelt Warnmeldungen für deinen Kreis. | ||
|
||
## Installation | ||
|
||
1. Navigiere in das `MagicMirror/modules` Verzeichnis und führe folgendes Kommando aus, um das Projekt auf deine Festplatte zu klonen: | ||
```bash | ||
git clone https://github.com/jalibu/MMM-NINA.git | ||
``` | ||
|
||
```bash | ||
git clone https://github.com/jalibu/MMM-NINA.git | ||
``` | ||
|
||
2. Wechsle nun in das MMM-NINA Modul Verzeichnis und führe darin folgendes Kommando aus, um die Dependencies zu installieren: | ||
```bash | ||
npm install | ||
``` | ||
3. Binde das Modul abschließend in die Magic Mirror Konfiguration `MagicMirror/config/config.js` ein. | ||
### Beispiel | ||
```javascript | ||
{ | ||
module: "MMM-NINA", | ||
position: "top_right", | ||
config: { | ||
updateIntervalInSeconds: 120, | ||
maxAgeInHours: 6, | ||
showNoWarning: true, | ||
ags: "110000000000", | ||
} | ||
```bash | ||
npm install --only=production | ||
``` | ||
3. Binde das Modul abschließend in die Magic Mirror Konfiguration `MagicMirror/config/config.js` ein (Beispiel Konfiguration). | ||
```javascript | ||
{ | ||
module: "MMM-NINA", | ||
position: "top_right", | ||
config: { | ||
updateIntervalInSeconds: 120, | ||
maxAgeInHours: 6, | ||
showNoWarning: true, | ||
ags: "110000000000", | ||
} | ||
``` | ||
} | ||
``` | ||
|
||
### Optionen | ||
| Feld | Beschreibung | Default | | ||
| -------- | -------- | -------- | | ||
| updateIntervalInSeconds | (Integer) Abstand in Sekunden, in dem Warnmeldungen vom NINA Server abgerufen werden | `120` (2 Minuten) | | ||
| maxAgeInHours | (Integer) Maximales Alter der Warnmeldungen in Stunden, bevor sie ausgefiltert werden | `6` | | ||
| showNoWarning | (Boolean) Lässt eine Meldung "Keine Warnungen" erscheinen, falls keine Ereignisse vorliegen. | false | | ||
| ags | (String) Amtlicher Gemeindeschlüssel (AGS) deines Ortes, welcher [hier](https://www.xrepository.de/api/xrepository/urn:de:bund:destatis:bevoelkerungsstatistik:schluessel:rs_2021-07-31/download/Regionalschl_ssel_2021-07-31.json) ermittelt werden kann.<br>**Wichtig**: Unbedingt als String und mit führenden Nullen angeben! | `"110000000000"` (Berlin) | | ||
|
||
| Feld | Beschreibung | Default | | ||
| ----------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------- | | ||
| updateIntervalInSeconds | (Integer) Abstand in Sekunden, in dem Warnmeldungen vom NINA Server abgerufen werden | `120` (2 Minuten) | | ||
| maxAgeInHours | (Integer) Maximales Alter der Warnmeldungen in Stunden, bevor sie ausgefiltert werden | `6` | | ||
| showNoWarning | (Boolean) Lässt eine Meldung "Keine Warnungen" erscheinen, falls keine Ereignisse vorliegen. | false | | ||
| ags | (String) Amtlicher Gemeindeschlüssel (AGS) deines Ortes, welcher [hier](https://www.xrepository.de/api/xrepository/urn:de:bund:destatis:bevoelkerungsstatistik:schluessel:rs_2021-07-31/download/Regionalschl_ssel_2021-07-31.json) ermittelt werden kann.<br>**Wichtig**: Unbedingt als String und mit führenden Nullen angeben! | `"110000000000"` (Berlin) | | ||
|
||
## Contribution and Development | ||
|
||
This module is written in TypeScript and compiled with Rollup. | ||
The source files are located in the `/src` folder. | ||
Compile target files with `npm run build`. | ||
|
||
Contribution for this module is welcome! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,29 @@ | ||
(()=>{"use strict";var e={944:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,s){function i(e){try{c(r.next(e))}catch(e){s(e)}}function a(e){try{c(r.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,a)}c((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const o=n(543),s=n(786);e.exports=o.create({start(){console.log(`${this.name} helper method started...`)},transformNinaAlerts(e,t){const n=(new Date).getTime();return e.filter((e=>(n-Date.parse(e.sent))/36e5<=t.maxAgeInHours))},harmonizeAgs:e=>e.substring(0,e.length-7)+"0000000",socketNotificationReceived(e,t){return r(this,void 0,void 0,(function*(){if("GET_NINA_ALERTS"===e){const e=yield s.default(`https://warnung.bund.de/api31/dashboard/${this.harmonizeAgs(t.ags)}.json`);if(e.ok)try{const n=yield e.json();this.sendSocketNotification("NINA_ALERTS_RESPONSE",this.transformNinaAlerts(n,t))}catch(e){console.warn("There was a problem requesting the NINA API",e)}else console.warn(`There was a problem ${e.status} requesting the NINA API:`,e.statusText)}else console.warn(`${e} is invalid notification`)}))}})},786:e=>{e.exports=require("node-fetch")},543:e=>{e.exports=require("node_helper")}},t={},n=function n(r){var o=t[r];if(void 0!==o)return o.exports;var s=t[r]={exports:{}};return e[r].call(s.exports,s,s.exports,n),s.exports}(944);module.exports=n})(); | ||
/*! ***************************************************************************** | ||
mmm-nina | ||
Version 1.0.0 | ||
Simple Client Implementierung für die NINA Warn App für die MagicMirror² Plattform. | ||
Please submit bugs at https://github.com/jalibu/MMM-NINA/issues | ||
(c) Jan.Litzenburger@gmail.com | ||
Licence: MIT | ||
This file is auto-generated. Do not edit. | ||
***************************************************************************** */ | ||
|
||
"use strict";var e=require("node_helper"),t=require("node-fetch");function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function r(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if("default"!==n){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var o=r(e),i=n(t); | ||
/*! ***************************************************************************** | ||
Copyright (c) Microsoft Corporation. | ||
Permission to use, copy, modify, and/or distribute this software for any | ||
purpose with or without fee is hereby granted. | ||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH | ||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY | ||
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, | ||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM | ||
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR | ||
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR | ||
PERFORMANCE OF THIS SOFTWARE. | ||
***************************************************************************** */ | ||
function a(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))}module.exports=o.create({start(){console.log(`${this.name} helper method started...`)},transformNinaAlerts(e,t){const n=(new Date).getTime();return e.filter((e=>(n-Date.parse(e.sent))/36e5<=t.maxAgeInHours))},harmonizeAgs:e=>e.substring(0,e.length-7)+"0000000",socketNotificationReceived(e,t){return a(this,void 0,void 0,(function*(){if("GET_NINA_ALERTS"===e){const e=yield i.default(`https://warnung.bund.de/api31/dashboard/${this.harmonizeAgs(t.ags)}.json`);if(e.ok)try{const n=yield e.json();this.sendSocketNotification("NINA_ALERTS_RESPONSE",this.transformNinaAlerts(n,t))}catch(e){console.warn("There was a problem requesting the NINA API",e)}else console.warn(`There was a problem ${e.status} requesting the NINA API:`,e.statusText)}else console.warn(`${e} is invalid notification`)}))}}); |
Oops, something went wrong.