Skip to content

Commit

Permalink
Update v2.0.20231119
Browse files Browse the repository at this point in the history
  • Loading branch information
Wilkware committed Nov 22, 2023
1 parent 62e7f11 commit 40c5ef0
Show file tree
Hide file tree
Showing 17 changed files with 502 additions and 111 deletions.
2 changes: 1 addition & 1 deletion AbfallNavi/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ v2.0.20231119

* _NEU_: Kompatibilität auf IPS 6.4 hoch gesetzt
* _NEU_: Support für v7 Visualisierung
* _FIX_: Sortierreihenfolge der Daten korriegiert
* _FIX_: Sortierreihenfolge der Daten korrigiert

v1.0.20221020

Expand Down
74 changes: 63 additions & 11 deletions AbfallNavi/form.json
Original file line number Diff line number Diff line change
Expand Up @@ -275,18 +275,8 @@
},
{
"type": "ExpansionPanel",
"caption": "Advanced settings ...",
"caption": "Visualisation ...",
"items": [
{
"type": "CheckBox",
"name": "settingsActivate",
"caption": "Activate daily update?"
},
{
"type": "CheckBox",
"name": "settingsVariables",
"caption": "Create variables for non-selected disposals?"
},
{
"type": "CheckBox",
"name": "settingsTileVisu",
Expand All @@ -308,6 +298,68 @@
}
]
},
{
"type": "List",
"name": "settingsTileColors",
"caption": "Waste groups:",
"add": false,
"delete": false,
"changeOrder": false,
"rowCount": 5,
"columns": [
{
"name": "Type",
"caption": "Waste Type:",
"save": true,
"visible": false
},
{
"name": "Term",
"caption": "Generic term:",
"save": true,
"width": "200px"
},
{
"name": "Color",
"caption": "Barrel colour:",
"width": "150px",
"edit": {
"type": "SelectColor",
"allowTransparent": false
}
},
{
"name": "Match",
"caption": "Search term:",
"width": "auto",
"add": "",
"edit": {
"type": "ValidationTextBox"
}
}
]
},
{
"type": "Label",
"label": "HINT: Always separate different search terms with | and do not use spaces!",
"italic": true
}
]
},
{
"type": "ExpansionPanel",
"caption": "Advanced settings ...",
"items": [
{
"type": "CheckBox",
"name": "settingsActivate",
"caption": "Activate daily update?"
},
{
"type": "CheckBox",
"name": "settingsVariables",
"caption": "Create variables for non-selected disposals?"
},
{
"type": "SelectScript",
"name": "settingsScript",
Expand Down
11 changes: 11 additions & 0 deletions AbfallNavi/locale.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,17 @@
"Friday": "Freitag",
"Saturday": "Samstag",
"Sunday": "Sonntag",
"Visualisation ...": "Visualisierung ...",
"Waste groups:": "Abfallgruppen:",
"Generic term:": "Allgemeiner Begriff:",
"Barrel colour:": "Farbe der Tonne:",
"Search term:": "Suchbegriff:",
"General Waste": "Allgemeiner Müll",
"Organic Waste": "Bioabfall",
"Recyclable Waste": "Recyclingmüll",
"Hazardous Waste": "Gefährlicher Abfall",
"Mixed Recycling Waste" : "Leichtverpackungen",
"HINT: Always separate different search terms with | and do not use spaces!": "HINWEIS: Verschiedene Suchbegriffe immer mit | trennen und keine Leerzeichen verwenden!",
"Disposal data ...": "Entsorgungsdaten ...",
"Update": "Aktualisieren",
"Creating instance.": "Die Instanz wird erstellt.",
Expand Down
20 changes: 15 additions & 5 deletions AbfallNavi/module.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ class AbfallNavi extends IPSModule
private const ELEM_LABEL = 1;
private const ELEM_PROVI = 2;
private const ELEM_REGIO = 3;
private const ELEM_VISU = 4;

/**
* Create.
Expand All @@ -73,12 +74,14 @@ public function Create()
for ($i = 1; $i <= static::$FRACTIONS; $i++) {
$this->RegisterPropertyBoolean('fractionID' . $i, false);
}
// Visualisation
$this->RegisterPropertyBoolean('settingsTileVisu', false);
$this->RegisterPropertyString('settingsTileSkin', 'dark');
$this->RegisterPropertyString('settingsTileColors', '[]');
// Advanced Settings
$this->RegisterPropertyBoolean('settingsActivate', true);
$this->RegisterPropertyBoolean('settingsVariables', false);
$this->RegisterPropertyInteger('settingsScript', 0);
$this->RegisterPropertyBoolean('settingsTileVisu', false);
$this->RegisterPropertyString('settingsTileSkin', 'dark');
// Attributes for dynamic configuration forms (> v3.0)
$this->RegisterAttributeString('io', serialize($this->PrepareIO()));
// Register daily update timer
Expand Down Expand Up @@ -258,6 +261,12 @@ public function GetConfigurationForm()
$this->WriteAttributeString('io', serialize($io));
// Debug output
$this->SendDebug(__FUNCTION__, $io);
//Only add default element if we do not have anything in persistence
$colors = json_decode($this->ReadPropertyString("settingsTileColors"), true);
if(empty($colors)) {
$this->SendDebug(__FUNCTION__, 'Translate Waste Visu');
$jsonForm['elements'][self::ELEM_VISU]['items'][2]['values'] = $this->GetWasteValues();
}
// Return Form
return json_encode($jsonForm);
}
Expand Down Expand Up @@ -373,10 +382,11 @@ public function Update()

// build tile widget
$btw = $this->ReadPropertyBoolean('settingsTileVisu');
$skin = $this->ReadPropertyString('settingsTileSkin');
$this->SendDebug(__FUNCTION__, 'TileVisu: ' . $btw . '(' . $skin . ')');
$this->SendDebug(__FUNCTION__, 'TileVisu: ' . $btw);
if ($btw == true) {
$this->BuildWidget($waste, $skin);
$skin = $this->ReadPropertyString('settingsTileSkin');
$list = json_decode($this->ReadPropertyString('settingsTileColors'), true);
$this->BuildWidget($waste, $skin, $list);
}

// execute Script
Expand Down
74 changes: 63 additions & 11 deletions Abfall_IO/form.json
Original file line number Diff line number Diff line change
Expand Up @@ -289,18 +289,8 @@
},
{
"type": "ExpansionPanel",
"caption": "Advanced settings ...",
"caption": "Visualisation ...",
"items": [
{
"type": "CheckBox",
"name": "settingsActivate",
"caption": "Activate daily update?"
},
{
"type": "CheckBox",
"name": "settingsVariables",
"caption": "Create variables for non-selected disposals?"
},
{
"type": "CheckBox",
"name": "settingsTileVisu",
Expand All @@ -322,6 +312,68 @@
}
]
},
{
"type": "List",
"name": "settingsTileColors",
"caption": "Waste groups:",
"add": false,
"delete": false,
"changeOrder": false,
"rowCount": 5,
"columns": [
{
"name": "Type",
"caption": "Waste Type:",
"save": true,
"visible": false
},
{
"name": "Term",
"caption": "Generic term:",
"save": true,
"width": "200px"
},
{
"name": "Color",
"caption": "Barrel colour:",
"width": "150px",
"edit": {
"type": "SelectColor",
"allowTransparent": false
}
},
{
"name": "Match",
"caption": "Search term:",
"width": "auto",
"add": "",
"edit": {
"type": "ValidationTextBox"
}
}
]
},
{
"type": "Label",
"label": "HINT: Always separate different search terms with | and do not use spaces!",
"italic": true
}
]
},
{
"type": "ExpansionPanel",
"caption": "Advanced settings ...",
"items": [
{
"type": "CheckBox",
"name": "settingsActivate",
"caption": "Activate daily update?"
},
{
"type": "CheckBox",
"name": "settingsVariables",
"caption": "Create variables for non-selected disposals?"
},
{
"type": "CheckBox",
"name": "settingsStartsWith",
Expand Down
11 changes: 11 additions & 0 deletions Abfall_IO/locale.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,17 @@
"Friday": "Freitag",
"Saturday": "Samstag",
"Sunday": "Sonntag",
"Visualisation ...": "Visualisierung ...",
"Waste groups:": "Abfallgruppen:",
"Generic term:": "Allgemeiner Begriff:",
"Barrel colour:": "Farbe der Tonne:",
"Search term:": "Suchbegriff:",
"General Waste": "Allgemeiner Müll",
"Organic Waste": "Bioabfall",
"Recyclable Waste": "Recyclingmüll",
"Hazardous Waste": "Gefährlicher Abfall",
"Mixed Recycling Waste" : "Leichtverpackungen",
"HINT: Always separate different search terms with | and do not use spaces!": "HINWEIS: Verschiedene Suchbegriffe immer mit | trennen und keine Leerzeichen verwenden!",
"Disposal data ...": "Entsorgungsdaten ...",
"Update": "Aktualisieren",
"Creating instance.": "Die Instanz wird erstellt.",
Expand Down
22 changes: 15 additions & 7 deletions Abfall_IO/module.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ class Abfall_IO extends IPSModule
private const ELEM_LABEL = 1;
private const ELEM_PROVI = 2;
private const ELEM_ABPIO = 3;
private const ELEM_VISU = 4;

/**
* Create.
Expand All @@ -68,14 +69,16 @@ public function Create()
for ($i = 1; $i <= static::$FRACTIONS; $i++) {
$this->RegisterPropertyBoolean('fractionID' . $i, false);
}
// Visualisation
$this->RegisterPropertyBoolean('settingsTileVisu', false);
$this->RegisterPropertyString('settingsTileSkin', 'dark');
$this->RegisterPropertyString('settingsTileColors', '[]');
// Advanced Settings
$this->RegisterPropertyBoolean('settingsActivate', true);
$this->RegisterPropertyBoolean('settingsVariables', false);
$this->RegisterPropertyBoolean('settingsStartsWith', false);
$this->RegisterPropertyInteger('settingsScript', 0);
$this->RegisterPropertyString('settingsFormat', 'ics');
$this->RegisterPropertyBoolean('settingsTileVisu', false);
$this->RegisterPropertyString('settingsTileSkin', 'dark');
// Attributes for dynamic configuration forms (> v3.0)
$this->RegisterAttributeString('io', serialize($this->PrepareIO()));
// Register daily update timer
Expand Down Expand Up @@ -272,12 +275,16 @@ public function GetConfigurationForm()
$next = false;
}
}

// Write IO array
$this->WriteAttributeString('io', serialize($io));

// Debug output
$this->SendDebug(__FUNCTION__, $io);
//Only add default element if we do not have anything in persistence
$colors = json_decode($this->ReadPropertyString("settingsTileColors"), true);
if(empty($colors)) {
$this->SendDebug(__FUNCTION__, 'Translate Waste Visu');
$jsonForm['elements'][self::ELEM_VISU]['items'][2]['values'] = $this->GetWasteValues();
}
// Return Form
return json_encode($jsonForm);
}
Expand Down Expand Up @@ -524,10 +531,11 @@ public function Update()

// build tile widget
$btw = $this->ReadPropertyBoolean('settingsTileVisu');
$skin = $this->ReadPropertyString('settingsTileSkin');
$this->SendDebug(__FUNCTION__, 'TileVisu: ' . $btw . '(' . $skin . ')');
$this->SendDebug(__FUNCTION__, 'TileVisu: ' . $btw);
if ($btw == true) {
$this->BuildWidget($waste, $skin);
$skin = $this->ReadPropertyString('settingsTileSkin');
$list = json_decode($this->ReadPropertyString('settingsTileColors'), true);
$this->BuildWidget($waste, $skin, $list);
}

// execute Script
Expand Down
Loading

0 comments on commit 40c5ef0

Please sign in to comment.