]> git.basschouten.com Git - openhab-addons.git/blob
66f6f4bcff33d01536bc8d543af85081c10c1192
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2024 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.solax.internal.local;
14
15 import static org.junit.jupiter.api.Assertions.assertEquals;
16
17 import org.eclipse.jdt.annotation.NonNullByDefault;
18 import org.openhab.binding.solax.internal.model.InverterType;
19 import org.openhab.binding.solax.internal.model.local.LocalInverterData;
20
21 /**
22  * The {@link TestX1BoostAirMiniDataParser} Simple test that tests for proper parsing against a real data from the
23  * inverter
24  *
25  * @author Konstantin Polihronov - Initial contribution
26  */
27 @NonNullByDefault
28 public class TestX1BoostAirMiniDataParser extends AbstractParserTest {
29
30     private static final String RAW_DATA = """
31             {
32                 sn:SR***,
33                 ver:3.006.04,
34                 type:4,
35                 Data:[
36                     2263,7,128,1519,0,9,0,138,0,5000,
37                     2,15569,0,7,0,0,0,0,0,0,
38                     0,0,0,0,0,0,0,0,0,0,
39                     0,0,0,0,0,0,0,0,0,13,
40                     0,4071,0,3456,0,0,0,0,0,0,
41                     0,0,0,0,0,23,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
42                 ],
43                 Information:[1.500,4,XM3A15IA669518,8,2.27,0.00,1.43,0.00,0.00,1]}
44             """;
45
46     @Override
47     protected String getRawData() {
48         return RAW_DATA;
49     }
50
51     @Override
52     protected void assertParserSpecific(LocalInverterData data) {
53         assertEquals("SR***", data.getWifiSerial());
54         assertEquals("3.006.04", data.getWifiVersion());
55
56         assertEquals(226.3, data.getInverterVoltage()); // [0]
57         assertEquals(0.7, data.getInverterCurrent()); // [1]
58         assertEquals(128, data.getInverterOutputPower()); // [2]
59
60         assertEquals(151.9, data.getPV1Voltage()); // [3]
61         assertEquals(0, data.getPV2Voltage()); // [4]
62         assertEquals(0.9, data.getPV1Current()); // [5]
63         assertEquals(0, data.getPV2Current()); // [6]
64         assertEquals(138, data.getPV1Power()); // [7]
65         assertEquals(0, data.getPV2Power()); // [8]
66
67         assertEquals(50, data.getInverterFrequency()); // [9]
68
69         assertEquals(1556.9, data.getTotalEnergy()); // [11]
70         assertEquals(0.7, data.getTodayEnergy()); // [13]
71
72         assertEquals(346, data.getPowerUsage()); // [43]
73     }
74
75     @Override
76     protected InverterType getInverterType() {
77         return InverterType.X1_BOOST_AIR_MINI;
78     }
79 }