Skip to content

Commit

Permalink
Merge branch 'master' into fixes/Avg-to-Consuption
Browse files Browse the repository at this point in the history
  • Loading branch information
paresy committed Feb 8, 2024
2 parents 7b1a7ce + a97f9d6 commit 8efae4c
Show file tree
Hide file tree
Showing 24 changed files with 378 additions and 362 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/style.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ jobs:
- name: Checkout module
uses: actions/checkout@master
- name: Check style
uses: symcon/action-style@master
uses: symcon/action-style@v3
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ libs/vendor/tecnickcom/tcpdf/fonts
composer.phar
.php_cs.cache
.phpunit.result.*
.phpunit.cache
.phpunit.cache
.php-cs-fixer.cache
2 changes: 1 addition & 1 deletion .style
Submodule .style updated 3 files
+42 −33 .php-cs-fixer.php
+22 −0 README.md
+85 −0 json-check.php
19 changes: 14 additions & 5 deletions MailReport/form.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,26 @@
"name": "Interval",
"caption": "Interval of Messages",
"options": [
{ "label": "Daily", "value": 1 },
{ "label": "Weekly", "value": 2 },
{ "label": "Monthly", "value": 3 }
{
"label": "Daily",
"value": 1
},
{
"label": "Weekly",
"value": 2
},
{
"label": "Monthly",
"value": 3
}
]
}
],
"actions": [
{
{
"type": "Button",
"label": "Send data",
"onClick": "MR_SendInfo($id);"
"onClick": "MR_SendInfo($id);"
}
]
}
5 changes: 3 additions & 2 deletions MailReport/locale.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"translations": {
"de": {
"de": {
"Send data": "Sende Daten",
"Aggregated Variable": "Aggregierte Variable",
"Interval of Messages": "Intervall der Nachrichten",
Expand All @@ -24,7 +24,8 @@
"November": "November",
"December": "Dezember",
"Mail Report active": "Mail Report aktiv",
"None": "Keine"
"None": "Keine",
"https://www.symcon.de/en/service/documentation/module-reference/symconreport/mailreport/": "https://www.symcon.de/de/service/dokumentation/modulreferenz/symconreport/mailreport/"
}
}
}
5 changes: 2 additions & 3 deletions MailReport/module.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,12 @@
"name": "MailReport",
"type": 3,
"vendor": "",
"aliases":
[
"aliases": [
"Report (Mail)"
],
"parentRequirements": [],
"childRequirements": [],
"implemented": [],
"prefix": "MR",
"url": "https://github.com/symcon/SymconReport/tree/master/MailReport"
"url": "https://www.symcon.de/en/service/documentation/module-reference/symconreport/mailreport/"
}
14 changes: 0 additions & 14 deletions PDFReportEnergie/module.json

This file was deleted.

File renamed without changes.
File renamed without changes
File renamed without changes.
8 changes: 5 additions & 3 deletions PDFReportEnergie/locale.json → PDFReportEnergy/locale.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,10 @@
"The Counter has no data for last month": "Die Zählervariable hat keine Daten für den letzten Monat",
"For Comparison": "Zum Vergleich",
"A tree bind each month ca. 1 kg CO².<br>In order to achieve the 2030 climate targets, the total energy consumption for heating and hot water must be reduced by <br>5.5% per year.<br>Your personal footprint can be found <a href = \"uba.co2-rechner.de\" >here </a> calculate.": "Ein Baum bindet pro Monat ca. 1 kg CO².<br>Um die Klimaziele 2030 zu erreichen, muss der gesamte Energieverbrauch für Heizung und Warmwasser pro Jahr<br>um 5,5 % sinken.<br>Ihren persönlichen Fußabdruck können Sie <a href = \"uba.co2-rechner.de\" >hier</a> ausrechnen.",
"Last year you used up %s.": "Im Vorjahr hatten sie einen Verbrauch von %s."

"Last year you used up %s.": "Im Vorjahr hatten sie einen Verbrauch von %s.",
"https://www.symcon.de/en/service/documentation/module-reference/symconreport/pdfreport-energy/": "https://www.symcon.de/de/service/dokumentation/modulreferenz/symconreport/pdfreport-energie/",
"PDFReportEnergy": "PDFReportEnergie",
"Report (PDF, Energy)": "Report (PDF, Energie)"
}
}
}
}
14 changes: 14 additions & 0 deletions PDFReportEnergy/module.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"id": "{0F74D76C-701E-8343-C563-091FBA9E7EBC}",
"name": "PDFReportEnergy",
"type": 3,
"vendor": "",
"aliases": [
"Report (PDF, Energy)"
],
"parentRequirements": [],
"childRequirements": [],
"implemented": [],
"prefix": "RAC",
"url": "https://www.symcon.de/en/service/documentation/module-reference/symconreport/pdfreport-energy/"
}
36 changes: 18 additions & 18 deletions PDFReportEnergie/module.php → PDFReportEnergy/module.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,24 +21,6 @@ public function Create()
$this->RegisterMediaDocument('ReportPDF', $this->Translate('Report (PDF)'), 'pdf');
}

private function RegisterMediaDocument($Ident, $Name, $Extension, $Position = 0)
{
$this->RegisterMedia(5, $Ident, $Name, $Extension, $Position);
}

private function RegisterMedia($Type, $Ident, $Name, $Extension, $Position)
{
$mediaId = @IPS_GetObjectIDByIdent($Ident, $this->InstanceID);
if ($mediaId === false) {
$mediaId = IPS_CreateMedia(5 /* Document */);
IPS_SetParent($mediaId, $this->InstanceID);
IPS_SetIdent($mediaId, $Ident);
IPS_SetName($mediaId, $Name);
IPS_SetPosition($mediaId, $Position);
IPS_SetMediaFile($mediaId, 'media/' . $mediaId . '.' . $Extension, false);
}
}

public function GenerateEnergyReport()
{
if (!IPS_VariableExists($this->ReadPropertyInteger('CounterID'))) {
Expand All @@ -58,6 +40,24 @@ public function GenerateEnergyReport()
return true;
}

private function RegisterMediaDocument($Ident, $Name, $Extension, $Position = 0)
{
$this->RegisterMedia(5, $Ident, $Name, $Extension, $Position);
}

private function RegisterMedia($Type, $Ident, $Name, $Extension, $Position)
{
$mediaId = @IPS_GetObjectIDByIdent($Ident, $this->InstanceID);
if ($mediaId === false) {
$mediaId = IPS_CreateMedia(5 /* Document */);
IPS_SetParent($mediaId, $this->InstanceID);
IPS_SetIdent($mediaId, $Ident);
IPS_SetName($mediaId, $Name);
IPS_SetPosition($mediaId, $Position);
IPS_SetMediaFile($mediaId, 'media/' . $mediaId . '.' . $Extension, false);
}
}

private function GeneratePDF($author, $filename)
{
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
Expand Down
177 changes: 89 additions & 88 deletions PDFReportMulti/form.json
Original file line number Diff line number Diff line change
@@ -1,101 +1,102 @@
{
"elements": [
{
"type": "Label",
"label": "Select a PNG file as your PDF logo"
},
{
"name": "LogoData",
"type": "SelectFile",
"caption": "Logo",
"extensions": ".png"
},
{
"type": "ValidationTextBox",
"name": "CompanyName",
"caption": "Company"
},
{
"type": "ValidationTextBox",
"name": "ReportTitle",
"caption": "Title"
},
{
"type": "ValidationTextBox",
"name": "ReportFooter",
"caption": "Footer"
},
{
"type": "List",
"name": "DataVariables",
"caption": "Data Sources",
"add": true,
"delete": true,
"rowCount": 5,
"columns": [
"elements": [
{
"caption": "VariableID",
"name": "VariableID",
"width": "150px",
"add": 0,
"edit": {
"type": "SelectVariable",
"requiredLogging": 1
}
}, {
"caption": "Column Name",
"name": "Name",
"width": "auto",
"add": "",
"edit": {
"type": "ValidationTextBox"
}
}
]
},
{
"name": "DataAggregation",
"type": "Select",
"caption": "Data Aggregation",
"options": [
"type": "Label",
"label": "Select a PNG file as your PDF logo"
},
{
"name": "LogoData",
"type": "SelectFile",
"caption": "Logo",
"extensions": ".png"
},
{
"type": "ValidationTextBox",
"name": "CompanyName",
"caption": "Company"
},
{
"type": "ValidationTextBox",
"name": "ReportTitle",
"caption": "Title"
},
{
"label": "Hour",
"value": 0
"type": "ValidationTextBox",
"name": "ReportFooter",
"caption": "Footer"
},
{
"label": "Day",
"value": 1
"type": "List",
"name": "DataVariables",
"caption": "Data Sources",
"add": true,
"delete": true,
"rowCount": 5,
"columns": [
{
"caption": "VariableID",
"name": "VariableID",
"width": "150px",
"add": 0,
"edit": {
"type": "SelectVariable",
"requiredLogging": 1
}
},
{
"caption": "Column Name",
"name": "Name",
"width": "auto",
"add": "",
"edit": {
"type": "ValidationTextBox"
}
}
]
},
{
"label": "Week",
"value": 2
"name": "DataAggregation",
"type": "Select",
"caption": "Data Aggregation",
"options": [
{
"label": "Hour",
"value": 0
},
{
"label": "Day",
"value": 1
},
{
"label": "Week",
"value": 2
},
{
"label": "Month",
"value": 3
},
{
"label": "Year",
"value": 4
}
]
},
{
"label": "Month",
"value": 3
"type": "NumberSpinner",
"name": "DataCount",
"caption": "Data Count"
},
{
"label": "Year",
"value": 4
"type": "CheckBox",
"name": "DataSkipFirst",
"caption": "Skip current unfinished dataset"
}
],
"actions": [
{
"type": "Button",
"label": "Generate report now!",
"onClick": "if(RAC_GenerateReport($id)) { \n echo (new IPSModule($id))->Translate('Done! Please open the media file beneath this instance!'); \n };"
}
]
},
{
"type": "NumberSpinner",
"name": "DataCount",
"caption": "Data Count"
},
{
"type": "CheckBox",
"name": "DataSkipFirst",
"caption": "Skip current unfinished dataset"
}
],
"actions": [
{
"type": "Button",
"label": "Generate report now!",
"onClick": "if(RAC_GenerateReport($id)) { \n echo (new IPSModule($id))->Translate('Done! Please open the media file beneath this instance!'); \n };"
}
]
]
}
Loading

0 comments on commit 8efae4c

Please sign in to comment.