Skip to content

Commit

Permalink
Merge pull request #2 from symcon/fixes/upgrade-style-to-v3
Browse files Browse the repository at this point in the history
Module-Store konform
  • Loading branch information
paresy authored Nov 27, 2023
2 parents 1103b88 + f9f9ea6 commit 598972b
Show file tree
Hide file tree
Showing 66 changed files with 1,301 additions and 1,587 deletions.
13 changes: 13 additions & 0 deletions .github/workflows/style.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Check Style

on: [push, pull_request]

jobs:

style:
runs-on: ubuntu-latest
steps:
- name: Checkout module
uses: actions/checkout@master
- name: Check style
uses: symcon/action-style@v3
15 changes: 15 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Run Tests

on: [push, pull_request]

jobs:

test:
runs-on: ubuntu-latest
steps:
- name: Checkout module
uses: actions/checkout@master
with:
submodules: true
- name: Run tests
uses: symcon/action-tests@master
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
.idea
.DS_Store
.idea/
.phpunit.*
.php_cs.cache
.php-cs-fixer.cache
6 changes: 6 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[submodule ".style"]
path = .style
url = https://github.com/symcon/StylePHP
[submodule "tests/stubs"]
path = tests/stubs
url = https://github.com/symcon/SymconStubs
1 change: 1 addition & 0 deletions .style
Submodule .style added at ec73bf
5 changes: 5 additions & 0 deletions ConsumptionCosts/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# VerbrauchKosten

[Link zur deutschen Dokumentation](https://www.symcon.de/de/service/dokumentation/modulreferenz/virtuelle-geraete/verbrauch-kosten/)

[Link to the english documentation](https://www.symcon.de/en/service/documentation/module-reference/virtual-devices/consumption-costs/)
1 change: 1 addition & 0 deletions ConsumptionCosts/form.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
3 changes: 2 additions & 1 deletion VerbrauchKosten/locale.json → ConsumptionCosts/locale.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
"de": {
"StandBy Consumption": "StandBy Verbrauch",
"Cost per kWh": "Kosten pro kWh",
"Total cost per year": "Gesamtkosten pro Jahr"
"Total cost per year": "Gesamtkosten pro Jahr",
"Consumption/Costs": "Verbrauch/Kosten"
}
}
}
6 changes: 3 additions & 3 deletions VerbrauchKosten/module.json → ConsumptionCosts/module.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"id": "{554BC118-FACE-A8BB-63B2-6BDD1B41A8F9}",
"name": "VerbrauchKosten",
"name": "Consumption Costs",
"type": 3,
"vendor": "",
"aliases": [
"Verbrauch/Kosten"
"Consumption/Costs"
],
"parentRequirements": [],
"childRequirements": [],
"implemented": [],
"prefix": "VM",
"prefix": "VG",
"url": "https://www.symcon.de"
}
42 changes: 42 additions & 0 deletions ConsumptionCosts/module.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?php

declare(strict_types=1);
class ConsumptionCosts extends IPSModule
{
public function Create()
{
parent::Create();

$profileName = 'WattSlider';
if (!IPS_VariableProfileExists($profileName)) {
IPS_CreateVariableProfile($profileName, VARIABLETYPE_FLOAT);
IPS_SetVariableProfileText($profileName, '', ' W');
IPS_SetVariableProfileValues($profileName, 0, 5000, 10);
IPS_SetVariableProfileDigits($profileName, 1);
IPS_SetVariableProfileIcon($profileName, 'Electricity');
}

$this->RegisterVariableFloat('Consumption', $this->Translate('StandBy Consumption'), $profileName, 0);
$this->EnableAction('Consumption');

$profileName = 'EuroCent';
if (!IPS_VariableProfileExists($profileName)) {
IPS_CreateVariableProfile($profileName, VARIABLETYPE_FLOAT);
IPS_SetVariableProfileText($profileName, '', '');
IPS_SetVariableProfileValues($profileName, 0, 10, 0.01);
IPS_SetVariableProfileDigits($profileName, 2);
IPS_SetVariableProfileIcon($profileName, 'Repeat');
}

$this->RegisterVariableFloat('CostPerKiloWatt', $this->Translate('Cost per kWh'), 'EuroCent', 1);
$this->EnableAction('CostPerKiloWatt');

$this->RegisterVariableFloat('TotalCostPerYear', $this->Translate('Total cost per year'), '~Euro', 2);
}

public function RequestAction($Ident, $Value)
{
$this->SetValue($Ident, $Value);
$this->SetValue('TotalCostPerYear', $this->GetValue('Consumption') / 1000 * $this->GetValue('CostPerKiloWatt') * 24 * 365);
}
}
67 changes: 0 additions & 67 deletions E-Auto/README.md

This file was deleted.

10 changes: 0 additions & 10 deletions E-Auto/locale.json

This file was deleted.

Loading

0 comments on commit 598972b

Please sign in to comment.