]> git.basschouten.com Git - openhab-addons.git/blob
5fdf4adac0afca43a259edf21d3e7fdd3c20f6e3
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2023 Contributors to the openHAB project
3  *
4  * See the NOTICE file(s) distributed with this work for additional
5  * information.
6  *
7  * This program and the accompanying materials are made available under the
8  * terms of the Eclipse Public License 2.0 which is available at
9  * http://www.eclipse.org/legal/epl-2.0
10  *
11  * SPDX-License-Identifier: EPL-2.0
12  */
13 package org.openhab.binding.loxone.internal.controls;
14
15 import org.junit.jupiter.api.BeforeEach;
16 import org.junit.jupiter.api.Test;
17 import org.openhab.core.library.types.DecimalType;
18 import org.openhab.core.library.types.OnOffType;
19 import org.openhab.core.library.types.PercentType;
20 import org.openhab.core.types.UnDefType;
21
22 /**
23  * Test class for (@link LxControlSauna} - version with vaporizer and door sensor
24  *
25  * @author Pawel Pieczul - initial contribution
26  *
27  */
28 public class LxControlSaunaDoorVaporizerTest extends LxControlSaunaDoorTest {
29     @Override
30     @BeforeEach
31     public void setup() {
32         setupControl("17452951-02ae-1b6e-ffff266cf17271dd", "0b734138-037d-034e-ffff403fb0c34b9e",
33                 "0fe650c2-0004-d446-ffff504f9410790f", "Sauna Controller With Vaporizer With Door Sensor");
34     }
35
36     @Override
37     @Test
38     public void testControlCreation() {
39         testControlCreation(LxControlSauna.class, 3, 0, 18, 18, 21);
40     }
41
42     @Override
43     @Test
44     public void testChannels() {
45         super.testChannels();
46         testChannel("Number", VAPOR_POWER_CHANNEL);
47         testChannel("Switch", OUT_OF_WATER_CHANNEL);
48         testChannel("Number", ACTUAL_HUMIDITY_CHANNEL);
49         testChannel("Number", TARGET_HUMIDITY_CHANNEL);
50         testChannel("Number", EVAPORATOR_MODE_CHANNEL);
51     }
52
53     @Override
54     @Test
55     public void vaporPowerChannel() {
56         for (Double i = 0.0; i <= 100.0; i += 1.0) {
57             changeLoxoneState("vaporpower", i);
58             testChannelState(VAPOR_POWER_CHANNEL, new PercentType(i.intValue()));
59         }
60         changeLoxoneState("vaporpower", -1.0);
61         testChannelState(VAPOR_POWER_CHANNEL, UnDefType.UNDEF);
62         changeLoxoneState("vaporpower", 100.1);
63         testChannelState(VAPOR_POWER_CHANNEL, UnDefType.UNDEF);
64     }
65
66     @Override
67     @Test
68     public void testOutOfWaterChannel() {
69         for (int i = 0; i < 5; i++) {
70             changeLoxoneState("lesswater", 0.0);
71             testChannelState(OUT_OF_WATER_CHANNEL, OnOffType.OFF);
72             changeLoxoneState("lesswater", 1.0);
73             testChannelState(OUT_OF_WATER_CHANNEL, OnOffType.ON);
74         }
75     }
76
77     @Override
78     @Test
79     public void testActualHumidityChannel() {
80         for (Double i = 0.0; i <= 100.0; i += 0.17) {
81             changeLoxoneState("humidityactual", i);
82             testChannelState(ACTUAL_HUMIDITY_CHANNEL, new DecimalType(i));
83         }
84     }
85
86     @Override
87     @Test
88     public void testTargetHumidityChannel() {
89         for (Double i = 0.0; i <= 100.0; i += 0.17) {
90             changeLoxoneState("humiditytarget", i);
91             testChannelState(TARGET_HUMIDITY_CHANNEL, new DecimalType(i));
92         }
93         for (Double i = 0.0; i <= 100.0; i += 0.13) {
94             executeCommand(TARGET_HUMIDITY_CHANNEL, new DecimalType(i));
95             testAction("humidity/" + i.toString());
96         }
97     }
98
99     @Override
100     @Test
101     public void testEvaporatorModelChannel() {
102         for (Double i = 0.0; i <= 6.0; i += 1.0) {
103             changeLoxoneState("mode", i);
104             testChannelState(EVAPORATOR_MODE_CHANNEL, new DecimalType(i));
105         }
106         for (Double i = -10.0; i < 0.0; i += 0.4) {
107             executeCommand(EVAPORATOR_MODE_CHANNEL, new DecimalType(i));
108             testAction(null);
109         }
110         for (Double i = 0.0; i < 6.0; i += 1.0) {
111             executeCommand(EVAPORATOR_MODE_CHANNEL, new DecimalType(i));
112             testAction("mode/" + i.toString());
113         }
114         for (Double i = 6.1; i < 15.0; i += 0.1) {
115             executeCommand(EVAPORATOR_MODE_CHANNEL, new DecimalType(i));
116             testAction(null);
117         }
118         for (Double i = 0.3; i < 6.0; i += 1.0) {
119             executeCommand(EVAPORATOR_MODE_CHANNEL, new DecimalType(i));
120             testAction(null);
121         }
122     }
123 }