Skip to content

Commit

Permalink
feat: #74 new device: ventilation
Browse files Browse the repository at this point in the history
  • Loading branch information
Hubert Pruszyński committed Sep 19, 2022
1 parent 3639732 commit 2301b8d
Show file tree
Hide file tree
Showing 10 changed files with 359 additions and 157 deletions.
26 changes: 15 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,24 +57,28 @@ Whole setup instruction is available on plugin configuration page in homebridge.
<td>Top hot water temperature (40013)</td>
</tr>
<tr>
<td>ers-exhaust-air</td>
<td>ERS exhaust air temperature (40025). ERS accessory is needed.</td>
<td>ventilation-exhaust-air</td>
<td>Ventilation/ERS exhaust air temperature (40025)</td>
</tr>
<tr>
<td>ers-extract-air</td>
<td>ERS extract air temperature (40026). ERS accessory is needed.</td>
<td>ventilation-extract-air</td>
<td>Ventilation/ERS extract air temperature (40026)</td>
</tr>
<tr>
<td>ers-supply-air</td>
<td>ERS supply air temperature (40075). ERS accessory is needed.</td>
<td>ventilation-supply-air</td>
<td>ERS supply air temperature (40075)</td>
</tr>
<tr>
<td>ers-outdoor</td>
<td>ERS outdoor temperature (40183). ERS accessory is needed.</td>
<td>ventilation-outdoor</td>
<td>ERS outdoor temperature (40183)</td>
</tr>
<tr>
<td>ers-fan</td>
<td>ERS fan speed (40311, 40312) with change rotation speed (47260). ERS accessory is needed.</td>
<td>ERS fan speed (40311, 40312) with change rotation speed (47260)</td>
</tr>
<tr>
<td>ventilation-fan</td>
<td>Ventilation fan speed (10001) with change rotation speed (47260)</td>
</tr>
</tbody>
</table>
Expand Down Expand Up @@ -154,10 +158,10 @@ However, you can also make all changes directly in homebridge config.json file.
<td>List of accessories to disable. Format 'id(name)' or 'id'.</td>
</tr>
<tr>
<td>ersStep0, ersStep1, ersStep2, ersStep3, ersStep4</td>
<td>ventilationStep0, ventilationStep1, ventilationStep2, ventilationStep3, ventilationStep4</td>
<td>No</td>
<td>65, 0, 30, 80, 100</td>
<td>ERS steps configured for your heat pomp. If values are not set correctly then changing ERS fan speed will not work.</td>
<td>Ventilation/ERS steps configured for your heat pomp. If values are not set correctly then changing Ventilation/ERS fan speed will not work correct.</td>
</tr>
</tbody>
</table>
Expand Down
24 changes: 12 additions & 12 deletions config.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,40 +66,40 @@
"placeholder": 60,
"description": "Period (in seconds) for fetching device changes from api"
},
"ersStep0": {
"title": "ERS step normal",
"ventilationStep0": {
"title": "Ventilation/ERS step normal",
"description": "You can check this value in SERVCIE menu -> operating settings -> fan speed exhaust air (5.1.5, 5.1.6)",
"type": "integer",
"minimum": 0,
"maximum": 100,
"placeholder": 65
},
"ersStep1": {
"title": "ERS step 1",
"ventilationStep1": {
"title": "Ventilation/ERS step 1",
"description": "You can check this value in SERVCIE menu -> operating settings -> fan speed exhaust air (5.1.5, 5.1.6)",
"type": "integer",
"minimum": 0,
"maximum": 100,
"placeholder": 0
},
"ersStep2": {
"title": "ERS step 2",
"ventilationStep2": {
"title": "Ventilation/ERS step 2",
"description": "You can check this value in SERVCIE menu -> operating settings -> fan speed exhaust air (5.1.5, 5.1.6)",
"type": "integer",
"minimum": 0,
"maximum": 100,
"placeholder": 30
},
"ersStep3": {
"title": "ERS step 3",
"ventilationStep3": {
"title": "Ventilation/ERS step 3",
"description": "You can check this value in SERVCIE menu -> operating settings -> fan speed exhaust air (5.1.5, 5.1.6)",
"type": "integer",
"minimum": 0,
"maximum": 100,
"placeholder": 80
},
"ersStep4": {
"title": "ERS step 4",
"ventilationStep4": {
"title": "Ventilation/ERS step 4",
"description": "You can check this value in SERVCIE menu -> operating settings -> fan speed exhaust air (5.1.5, 5.1.6)",
"type": "integer",
"minimum": 0,
Expand Down Expand Up @@ -141,12 +141,12 @@
},
{
"type": "fieldset",
"title": "ERS Configuration",
"title": "Ventilation/ERS Configuration",
"description": "",
"expandable": true,
"expanded": false,
"items": [
"ersStep0","ersStep1","ersStep2","ersStep3","ersStep4"
"ventilationStep0","ventilationStep1","ventilationStep2","ventilationStep3","ventilationStep4"
]
},
{
Expand Down
57 changes: 47 additions & 10 deletions config/accessories.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,8 @@ accessoriesConfiguration:
props:
maxValue: 70
refresh: true
- id: ers-exhaust-air
name: ers-exhaust-air
- id: ventilation-exhaust-air
name: ventilation-exhaust-air
condition:
parameterIds: [40025]
services:
Expand All @@ -133,8 +133,8 @@ accessoriesConfiguration:
- type: Name
value: temperature.name
translate: true
- id: ers-extract-air
name: ers-extract-air
- id: ventilation-extract-air
name: ventilation-extract-air
condition:
parameterIds: [40026]
services:
Expand All @@ -146,8 +146,8 @@ accessoriesConfiguration:
- type: Name
value: temperature.name
translate: true
- id: ers-supply-air
name: ers-supply-air
- id: ventilation-supply-air
name: ventilation-supply-air
condition:
parameterIds: [40075]
services:
Expand All @@ -159,8 +159,8 @@ accessoriesConfiguration:
- type: Name
value: temperature.name
translate: true
- id: ers-outdoor
name: ers-outdoor
- id: ventilation-outdoor
name: ventilation-outdoor
condition:
parameterIds: [40183]
services:
Expand Down Expand Up @@ -192,7 +192,7 @@ accessoriesConfiguration:
manage:
id: 47260
provider:
name: ErsRotationSpeedSetter
name: VentilationRotationSpeedSetter
- type: CurrentFanState
provider:
name: MaxValue
Expand All @@ -212,9 +212,46 @@ accessoriesConfiguration:
manage:
id: 47260
provider:
name: ErsRotationSpeedStepSetter
name: VentilationRotationSpeedStepSetter
params:
ids: [40311, 40312]
- type: Name
value: fan.name
translate: true
- id: ventilation-fan
name: ventilation-fan
condition:
parameterIds: [10001]
services:
- type: Fanv2
characteristics:
- type: Active
id: 10001
refresh: true
parser: graterThan0
mapper:
- true: 1
- false: 0
manage:
id: 47260
provider:
name: VentilationRotationSpeedSetter
- type: CurrentFanState
id: 10001
refresh: true
parser: graterThan0
mapper:
- true: 2
- false: 1
- type: RotationSpeed
id: 10001
refresh: true
manage:
id: 47260
provider:
name: VentilationRotationSpeedStepSetter
params:
ids: [10001]
- type: Name
value: fan.name
translate: true
18 changes: 10 additions & 8 deletions lang/en.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,15 @@ hot-water:
hot-water-top:
temperature.top.name: Nibe top hot water temperature

ers-exhaust-air:
temperature.name: Nibe ERS exhaust air temperature
ers-extract-air:
temperature.name: Nibe ERS extract air temperature
ers-supply-air:
temperature.name: Nibe ERS supply air temperature
ers-outdoor:
temperature.name: Nibe ERS outdoor temperature
ventilation-exhaust-air:
temperature.name: Nibe exhaust air temperature
ventilation-extract-air:
temperature.name: Nibe extract air temperature
ventilation-supply-air:
temperature.name: Nibe supply air temperature
ventilation-outdoor:
temperature.name: Nibe ventilation outdoor temperature
ers-fan:
fan.name: Nibe ERS
ventilation-fan:
fan.name: Nibe ventilation
18 changes: 10 additions & 8 deletions lang/pl.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,15 @@ hot-water:
hot-water-top:
temperature.top.name: Nibe najwyższa temperatura C.W.U

ers-exhaust-air:
temperature.name: Nibe ERS temperatura powietrza wywiewanego
ers-extract-air:
temperature.name: Nibe ERS temperatura powietrza usuwanego
ers-supply-air:
temperature.name: Nibe ERS temperatura powietrza nawiewanego
ers-outdoor:
temperature.name: Nibe ERS temperatura zewnętrzna
ventilation-exhaust-air:
temperature.name: Nibe temperatura powietrza wywiewanego
ventilation-extract-air:
temperature.name: Nibe temperatura powietrza usuwanego
ventilation-supply-air:
temperature.name: Nibe temperatura powietrza nawiewanego
ventilation-outdoor:
temperature.name: Nibe temperatura zewnętrzna z wentylacji
ers-fan:
fan.name: Nibe ERS
ventilation-fan:
fan.name: Nibe wentylacja
14 changes: 8 additions & 6 deletions lang/sv.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,15 @@ hot-water:
hot-water-top:
temperature.top.name: Nibe varmvatten topp

ers-exhaust-air:
ventilation-exhaust-air:
temperature.name: Nibe frånluft
ers-extract-air:
ventilation-extract-air:
temperature.name: Nibe avluft
ers-supply-air:
temperature.name: Nibe ERS tillufttemperatur
ers-outdoor:
temperature.name: Nibe ERS utetemperatur
ventilation-supply-air:
temperature.name: Nibe tillufttemperatur
ventilation-outdoor:
temperature.name: Nibe ventilation utetemperatur
ers-fan:
fan.name: Nibe ERS
ventilation-fan:
fan.name: Nibe ventilation
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "homebridge-nibe",
"displayName": "Homebridge Nibe",
"version": "1.0.1",
"version": "1.1.0",
"description": "Homebridge plugin for Nibe services",
"author": "Hubert Pruszynski <[email protected]>",
"license": "MIT",
Expand Down
24 changes: 12 additions & 12 deletions src/nibe/provider/Provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
import { Parameter } from '../DataModel';
import { PlatformAdapter } from '../PlatformAdapter';

function getErsConfig(platform: PlatformAdapter) {
function getVentilationStepConfig(platform: PlatformAdapter) {
return [
platform.getConfig('ersStep0') || 65,
platform.getConfig('ersStep1') || 0,
platform.getConfig('ersStep2') || 30,
platform.getConfig('ersStep3') || 80,
platform.getConfig('ersStep4') || 100,
platform.getConfig('ventilationStep0') || 65,
platform.getConfig('ventilationStep1') || 0,
platform.getConfig('ventilationStep2') || 30,
platform.getConfig('ventilationStep3') || 80,
platform.getConfig('ventilationStep4') || 100,
];
}

Expand All @@ -29,12 +29,12 @@ class MaxValue extends Provider {
}
}

class ErsRotationSpeedStepSetter extends MaxValue {
class VentilationRotationSpeedStepSetter extends MaxValue {
public provide(parameters: Map<number, Parameter>, providerParameters: any, platform: PlatformAdapter) {
const value = super.provide(parameters, providerParameters, platform);
const newValue = providerParameters.newValue;

const config = getErsConfig(platform);
const config = getVentilationStepConfig(platform);

const reverse = value < newValue;
const steps = reverse ? [...config].sort((n1,n2) => n1 - n2) : [...config].sort((n1,n2) => n2 - n1);
Expand Down Expand Up @@ -69,10 +69,10 @@ class ErsRotationSpeedStepSetter extends MaxValue {
}
}

class ErsRotationSpeedSetter extends Provider {
class VentilationRotationSpeedSetter extends Provider {
public provide(parameters: Map<number, Parameter>, providerParameters: any, platform: PlatformAdapter) {
const newValue = providerParameters.newValue;
const config = getErsConfig(platform);
const config = getVentilationStepConfig(platform);

if (newValue === 0) {
// find 0% rotation speed
Expand All @@ -91,8 +91,8 @@ export abstract class ProviderManager {
if (!ProviderManager.providers) {
ProviderManager.providers = {};
ProviderManager.providers.MaxValue = new MaxValue();
ProviderManager.providers.ErsRotationSpeedStepSetter = new ErsRotationSpeedStepSetter();
ProviderManager.providers.ErsRotationSpeedSetter = new ErsRotationSpeedSetter();
ProviderManager.providers.VentilationRotationSpeedStepSetter = new VentilationRotationSpeedStepSetter();
ProviderManager.providers.VentilationRotationSpeedSetter = new VentilationRotationSpeedSetter();
}

return ProviderManager.providers[name];
Expand Down
Loading

0 comments on commit 2301b8d

Please sign in to comment.