Skip to content

Commit

Permalink
Update v4.2.20240702
Browse files Browse the repository at this point in the history
  • Loading branch information
Wilkware committed Jul 2, 2024
1 parent 8d79e23 commit 34c4366
Show file tree
Hide file tree
Showing 28 changed files with 637 additions and 77 deletions.
27 changes: 22 additions & 5 deletions AbfallNavi/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[![Version](https://img.shields.io/badge/Symcon-PHP--Modul-red.svg?style=flat-square)](https://www.symcon.de/service/dokumentation/entwicklerbereich/sdk-tools/sdk-php/)
[![Product](https://img.shields.io/badge/Symcon%20Version-6.4-blue.svg?style=flat-square)](https://www.symcon.de/produkt/)
[![Version](https://img.shields.io/badge/Modul%20Version-2.1.20240304-orange.svg?style=flat-square)](https://github.com/Wilkware/WasteManagement)
[![Version](https://img.shields.io/badge/Modul%20Version-2.2.20240702-orange.svg?style=flat-square)](https://github.com/Wilkware/WasteManagement)
[![License](https://img.shields.io/badge/License-CC%20BY--NC--SA%204.0-green.svg?style=flat-square)](https://creativecommons.org/licenses/by-nc-sa/4.0/)
[![Actions](https://img.shields.io/github/actions/workflow/status/wilkware/WasteManagement/style.yml?branch=main&label=CheckStyle&style=flat-square)](https://github.com/Wilkware/WasteManagement/actions)

Expand Down Expand Up @@ -68,10 +68,12 @@ Entsorgungen | Entsorgungsarten, d.h. was wird im Gebiet an Entsorgun

> Visualisierung ...
Name | Beschreibung
--------------------------------------------- | ---------------------------------
Unterstützung für Tile Visu aktivieren? | Aktivierung, ob HTML für Kacheldarstellung erstellt werden soll
Abfallgruppen | Farbliche Zuordnung der Abfallarten
Name | Beschreibung
------------------------------------------------------- | ---------------------------------
Unterstützung für Tile Visu aktivieren? | Aktivierung, ob HTML für Kacheldarstellung erstellt werden soll
Abfallgruppen | Farbliche Zuordnung der Abfallarten
Vorrausschauende Anzeige für Folgetage aktivieren? | Aktivierung, ob zu einer bestimmten Zeit die Anzeige umschalten soll auf Folgetermine
Zeitpunkt | Uhrzeit, wo die Umschaltung erfolgen soll

> Erweiterte Einstellungen ...
Expand Down Expand Up @@ -104,6 +106,15 @@ Aber wie bei der Konfiguration beschrieben, muss man aufpassen wenn die Konfigur

### 7. PHP-Befehlsreferenz

```php
void REGIO_LookAhead(int $InstanzID);
```

Stellt in der Visualisierung den für Folgetage anstehenden Entsorgungstermine dar.
Die Funktion liefert keinerlei Rückgabewert.

__Beispiel__: `REGIO_LookAhead(12345);`

```php
void REGIO_Update(int $InstanzID);
```
Expand All @@ -115,6 +126,12 @@ __Beispiel__: `REGIO_Update(12345);`

### 8. Versionshistorie

v2.2.20240702

* _NEU_: Fallback wenn Service fehlschlägt (keine Subdomain)
* _NEU_: Vorrausschauende Anzeige
* _FIX_: URL Prüfung verbessert

v2.1.20240304

* _FIX_: User-Agent für Datenabruf korrigiert
Expand Down
21 changes: 21 additions & 0 deletions AbfallNavi/form.json
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,27 @@
"type": "Label",
"label": "HINT: Always separate different search terms with | and do not use spaces!",
"italic": true
},
{
"type": "CheckBox",
"name": "settingsLookAhead",
"caption": "Activate predictive display for the following days?"
},
{
"type": "RowLayout",
"items": [
{
"type": "SelectTime",
"name": "settingsLookTime",
"caption": "Time:",
"width": "250px"
},
{
"type": "Label",
"caption": "\nTimes before 0:30 am will not be considered!",
"italic": true
}
]
}
]
},
Expand Down
8 changes: 4 additions & 4 deletions AbfallNavi/locale.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,16 @@
"Subsequent execution of a script:": "Anschließendes Ausführen eines Skriptes:",
"Script:": "Script:",
"Activate support for Tile Visu?": "Unterstützung für Tile Visu aktivieren?",
"Theme to be used (design):": "Zu verwendendes Theme (Design):",
"Dark": "Dunkel",
"Light": "Hell",
"Activate predictive display for the following days?": "Vorrausschauende Anzeige für Folgetage aktivieren?",
"Time:": "Zeitpunkt:",
"\nTimes before 0:30 am will not be considered!": "\nZeiten vor 0:30 Uhr werden nicht berücksichtigt!",
"Waste": "Abfall",
"Pickup": "Abholung",
"Removal": "Abfuhr",
"Date": "Termin",
"Today": "Heute",
"Tomorrow": "Morgen",
"days": "Tage",
"days": "Tagen",
"day": "Tag",
"Next pickup:": "Nächste Abholung:",
"on": "am",
Expand Down
59 changes: 57 additions & 2 deletions AbfallNavi/module.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class AbfallNavi extends IPSModule
private const SERVICE_PROVIDER = 'regio';
private const SERVICE_USERAGENT = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36';
private const SERVICE_BASEURL = 'https://{{region}}-abfallapp.regioit.de/abfall-app-{{region}}';
private const SERVICE_FALLBACK = 'https://abfallapp.regioit.de/abfall-app-{{region}}';

// GET actions
private const GET_CITIES = '/rest/orte';
Expand Down Expand Up @@ -77,6 +78,8 @@ public function Create()
// Visualisation
$this->RegisterPropertyBoolean('settingsTileVisu', false);
$this->RegisterPropertyString('settingsTileColors', '[]');
$this->RegisterPropertyBoolean('settingsLookAhead', false);
$this->RegisterPropertyString('settingsLookTime', '{"hour":12,"minute":0,"second":0}');
// Advanced Settings
$this->RegisterPropertyBoolean('settingsActivate', true);
$this->RegisterPropertyBoolean('settingsVariables', false);
Expand All @@ -85,6 +88,8 @@ public function Create()
$this->RegisterAttributeString('io', serialize($this->PrepareIO()));
// Register daily update timer
$this->RegisterTimer('UpdateTimer', 0, 'REGIO_Update(' . $this->InstanceID . ');');
// Register daily look ahead timer
$this->RegisterTimer('LookAheadTimer', 0, 'REGIO_LookAhead(' . $this->InstanceID . ');');

$this->SetBuffer(self::SB_PLACE, '');
$this->SetBuffer(self::SB_STREET, '');
Expand Down Expand Up @@ -280,9 +285,11 @@ public function ApplyChanges()
$aId = $this->ReadPropertyString('addonID');
$activate = $this->ReadPropertyBoolean('settingsActivate');
$tilevisu = $this->ReadPropertyBoolean('settingsTileVisu');
$loakahead = $this->ReadPropertyBoolean('settingsLookAhead');
$this->SendDebug(__FUNCTION__, 'clientID=' . $cId . ', placeId=' . $pId . ', streetId=' . $sId . ', addonId=' . $aId);
// Safty default
$this->SetTimerInterval('UpdateTimer', 0);
$this->SetTimerInterval('LookAheadTimer', 0);
// Support for Tile Viso (v7.x)
$this->MaintainVariable('Widget', $this->Translate('Pickup'), VARIABLETYPE_STRING, '~HTMLBox', 0, $tilevisu);
// Set status
Expand All @@ -301,7 +308,15 @@ public function ApplyChanges()
if ($activate == true) {
// Time neu berechnen
$this->UpdateTimerInterval('UpdateTimer', 0, 10, 0);
$this->SendDebug(__FUNCTION__, 'Timer aktiviert!');
$this->SendDebug(__FUNCTION__, 'Update Timer aktiviert!');
if ($loakahead & $tilevisu) {
$time = json_decode($this->ReadPropertyString('settingsLookTime'), true);
if (($time['hour'] == 0) && ($time['minute'] <= 30)) {
$this->SendDebug(__FUNCTION__, 'LookAhead Time zu niedrieg!');
} else {
$this->UpdateTimerInterval('LookAheadTimer', $time['hour'], $time['minute'], $time['second'], 0);
}
}
} else {
$status = 104;
}
Expand All @@ -327,7 +342,43 @@ public function RequestAction($ident, $value)
* This function will be available automatically after the module is imported with the module control.
* Using the custom prefix this function will be callable from PHP and JSON-RPC through:.
*
* AWIDO_Update($id);
* REGIO_LookAhead($id);
*/
public function LookAhead()
{
// Check instance state
if ($this->GetStatus() != 102) {
$this->SendDebug(__FUNCTION__, 'Status: Instance is not active.');
return;
}
// rebuild informations
$io = unserialize($this->ReadAttributeString('io'));
$this->SendDebug(__FUNCTION__, $io);
// fractions convert to name => ident
$i = 1;
$waste = [];
foreach ($io[self::IO_NAMES] as $ident => $name) {
$this->SendDebug(__FUNCTION__, 'Fraction ident: ' . $ident . ', Name: ' . $name);
$enabled = $this->ReadPropertyBoolean('fractionID' . $i++);
if ($enabled) {
$date = $this->GetValue($ident);
$waste[$ident] = ['ident' => $ident, 'date' => $date];
}
}
$this->SendDebug(__FUNCTION__, $waste);
// update tile widget
$list = json_decode($this->ReadPropertyString('settingsTileColors'), true);
$this->BuildWidget($waste, $list, true);
// Set Timer to the next day
$time = json_decode($this->ReadPropertyString('settingsLookTime'), true);
$this->UpdateTimerInterval('LookAheadTimer', $time['hour'], $time['minute'], $time['second']);
}

/**
* This function will be available automatically after the module is imported with the module control.
* Using the custom prefix this function will be callable from PHP and JSON-RPC through:.
*
* REGIO_Update($id);
*/
public function Update()
{
Expand Down Expand Up @@ -729,6 +780,10 @@ protected function UpdateIO(&$io, $action, $id)
protected function BuildURL($key, $action, $params = null)
{
$url = self::SERVICE_BASEURL . $action;
// quick hack, later better
if ($key == 'unna') {
$url = self::SERVICE_FALLBACK . $action;
}
$str = ['region' => $key];
if ($params != null) {
$str = array_merge($str, $params);
Expand Down
26 changes: 21 additions & 5 deletions Abfall_ICS/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[![Version](https://img.shields.io/badge/Symcon-PHP--Modul-red.svg?style=flat-square)](https://www.symcon.de/service/dokumentation/entwicklerbereich/sdk-tools/sdk-php/)
[![Product](https://img.shields.io/badge/Symcon%20Version-6.4-blue.svg?style=flat-square)](https://www.symcon.de/produkt/)
[![Version](https://img.shields.io/badge/Modul%20Version-1.0.20240304-orange.svg?style=flat-square)](https://github.com/Wilkware/WasteManagement)
[![Version](https://img.shields.io/badge/Modul%20Version-1.1.20240702-orange.svg?style=flat-square)](https://github.com/Wilkware/WasteManagement)
[![License](https://img.shields.io/badge/License-CC%20BY--NC--SA%204.0-green.svg?style=flat-square)](https://creativecommons.org/licenses/by-nc-sa/4.0/)
[![Actions](https://img.shields.io/github/actions/workflow/status/wilkware/WasteManagement/style.yml?branch=main&label=CheckStyle&style=flat-square)](https://github.com/Wilkware/WasteManagement/actions)

Expand Down Expand Up @@ -66,10 +66,12 @@ Entsorgungen | Entsorgungsarten, d.h. was wird im Gebiet an

> Visualisierung ...
Name | Beschreibung
--------------------------------------------- | ---------------------------------
Unterstützung für Tile Visu aktivieren? | Aktivierung, ob HTML für Kacheldarstellung erstellt werden soll
Abfallgruppen | Farbliche Zuordnung der Abfallarten
Name | Beschreibung
------------------------------------------------------- | ---------------------------------
Unterstützung für Tile Visu aktivieren? | Aktivierung, ob HTML für Kacheldarstellung erstellt werden soll
Abfallgruppen | Farbliche Zuordnung der Abfallarten
Vorrausschauende Anzeige für Folgetage aktivieren? | Aktivierung, ob zu einer bestimmten Zeit die Anzeige umschalten soll auf Folgetermine
Zeitpunkt | Uhrzeit, wo die Umschaltung erfolgen soll

> Erweiterte Einstellungen ...
Expand Down Expand Up @@ -102,6 +104,15 @@ Aber wie bei der Konfiguration beschrieben, muss man aufpassen wenn die Konfigur

### 7. PHP-Befehlsreferenz

```php
void WMICS_LookAhead(int $InstanzID);
```

Stellt in der Visualisierung den für Folgetage anstehenden Entsorgungstermine dar.
Die Funktion liefert keinerlei Rückgabewert.

__Beispiel__: `WMICS_LookAhead(12345);`

```php
void WMICS_Update(int $InstanzID);
```
Expand All @@ -114,6 +125,11 @@ __Beispiel__: `WMICS_Update(12345);`

### 8. Versionshistorie

v1.1.20240702

* _NEU_: Vorrausschauende Anzeige
* _FIX_: URL Prüfung verbessert

v1.0.20240304

* _NEU_: Initialversion
Expand Down
23 changes: 22 additions & 1 deletion Abfall_ICS/form.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
"name": "clientURL",
"caption": "Download URL (iCal-File):",
"width": "900px",
"validate": "^(https?://)([a-z0-9]+([\\-\\.]{1}[a-z0-9]+)*\\.[a-z]{2,5})(:[0-9]{1,5})?(/.*)?$"
"validate": "^(http(s?):\\/\\/)?(((www\\.)?[a-zA-Z0-9\\.\\-\\_]+(\\.[a-zA-Z]{2,3})+)(:[0-9]{1,5})?|(\\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\b))(:[0-9]{1,5})?(\\/[a-zA-Z0-9\\_\\-\\s\\.\\/\\?\\%\\#\\&\\=]*)?$"
}
]
},
Expand Down Expand Up @@ -309,6 +309,27 @@
"type": "Label",
"label": "HINT: Always separate different search terms with | and do not use spaces!",
"italic": true
},
{
"type": "CheckBox",
"name": "settingsLookAhead",
"caption": "Activate predictive display for the following days?"
},
{
"type": "RowLayout",
"items": [
{
"type": "SelectTime",
"name": "settingsLookTime",
"caption": "Time:",
"width": "250px"
},
{
"type": "Label",
"caption": "\nTimes before 0:30 am will not be considered!",
"italic": true
}
]
}
]
},
Expand Down
5 changes: 4 additions & 1 deletion Abfall_ICS/locale.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,16 @@
"Subsequent execution of a script:": "Anschließendes Ausführen eines Skriptes:",
"Script:": "Script:",
"Activate support for Tile Visu?": "Unterstützung für Tile Visu aktivieren?",
"Activate predictive display for the following days?": "Vorrausschauende Anzeige für Folgetage aktivieren?",
"Time:": "Zeitpunkt:",
"\nTimes before 0:30 am will not be considered!": "\nZeiten vor 0:30 Uhr werden nicht berücksichtigt!",
"Waste": "Abfall",
"Pickup": "Abholung",
"Removal": "Abfuhr",
"Date": "Termin",
"Today": "Heute",
"Tomorrow": "Morgen",
"days": "Tage",
"days": "Tagen",
"day": "Tag",
"Next pickup:": "Nächste Abholung:",
"on": "am",
Expand Down
Loading

0 comments on commit 34c4366

Please sign in to comment.