forked from openhab/openhab-addons
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[solax] Add support for Solax X3MIC / G2 inverter and workmode channel (
openhab#16248) * Support for Solax X3MIC / G2 inverter, and workmode channel for the existing X1, X3 also * Add update instructions and make raise the target version to 1 * Refactor the workmode to be enum instead of string constants Signed-off-by: Henrik Tóth <realthk@gmail.com> Signed-off-by: Konstantin Polihronov <polychronov@gmail.com> Signed-off-by: Leo Siepel <leosiepel@gmail.com> Signed-off-by: Jørgen Austvik <jaustvik@acm.org>
- Loading branch information
Showing
17 changed files
with
452 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
153 changes: 153 additions & 0 deletions
153
...src/main/java/org/openhab/binding/solax/internal/model/impl/X3MicOrProG2InverterData.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,153 @@ | ||
/** | ||
* Copyright (c) 2010-2024 Contributors to the openHAB project | ||
* | ||
* See the NOTICE file(s) distributed with this work for additional | ||
* information. | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License 2.0 which is available at | ||
* http://www.eclipse.org/legal/epl-2.0 | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
*/ | ||
package org.openhab.binding.solax.internal.model.impl; | ||
|
||
import org.eclipse.jdt.annotation.NonNullByDefault; | ||
import org.openhab.binding.solax.internal.connectivity.rawdata.LocalConnectRawDataBean; | ||
|
||
/** | ||
* The {@link X3HybridG4InverterData} is responsible for handling commands, which are | ||
* sent to one of the channels. | ||
* | ||
* @author Henrik Tóth - Initial contribution | ||
* (based on X1/X3 G4 parser from Konstantin Polihronov) | ||
*/ | ||
@NonNullByDefault | ||
public class X3MicOrProG2InverterData extends CommonInverterData { | ||
|
||
public X3MicOrProG2InverterData(LocalConnectRawDataBean data) { | ||
super(data); | ||
} | ||
|
||
// Inverter data | ||
|
||
@Override | ||
public double getVoltagePhase1() { | ||
return ((double) getData(0)) / 10; | ||
} | ||
|
||
@Override | ||
public double getVoltagePhase2() { | ||
return ((double) getData(1)) / 10; | ||
} | ||
|
||
@Override | ||
public double getVoltagePhase3() { | ||
return ((double) getData(2)) / 10; | ||
} | ||
|
||
@Override | ||
public double getCurrentPhase1() { | ||
return ((double) getData(3)) / 10; | ||
} | ||
|
||
@Override | ||
public double getCurrentPhase2() { | ||
return ((double) getData(4)) / 10; | ||
} | ||
|
||
@Override | ||
public double getCurrentPhase3() { | ||
return ((double) getData(5)) / 10; | ||
} | ||
|
||
@Override | ||
public short getOutputPowerPhase1() { | ||
return getData(6); | ||
} | ||
|
||
@Override | ||
public short getOutputPowerPhase2() { | ||
return getData(7); | ||
} | ||
|
||
@Override | ||
public short getOutputPowerPhase3() { | ||
return getData(8); | ||
} | ||
|
||
@Override | ||
public double getPV1Voltage() { | ||
return ((double) getData(9)) / 10; | ||
} | ||
|
||
@Override | ||
public double getPV2Voltage() { | ||
return ((double) getData(10)) / 10; | ||
} | ||
|
||
@Override | ||
public double getPV1Current() { | ||
return ((double) getData(12)) / 10; | ||
} | ||
|
||
@Override | ||
public double getPV2Current() { | ||
return ((double) getData(13)) / 10; | ||
} | ||
|
||
@Override | ||
public short getPV1Power() { | ||
return getData(15); | ||
} | ||
|
||
@Override | ||
public short getPV2Power() { | ||
return getData(16); | ||
} | ||
|
||
@Override | ||
public double getFrequencyPhase1() { | ||
return ((double) getData(18)) / 100; | ||
} | ||
|
||
@Override | ||
public double getFrequencyPhase2() { | ||
return ((double) getData(19)) / 100; | ||
} | ||
|
||
@Override | ||
public double getFrequencyPhase3() { | ||
return ((double) getData(20)) / 100; | ||
} | ||
|
||
@Override | ||
public short getInverterWorkModeCode() { | ||
return getData(21); | ||
} | ||
|
||
@Override | ||
public double getTotalEnergy() { | ||
return ((double) getData(22)) / 10; | ||
} | ||
|
||
@Override | ||
public double getTodayEnergy() { | ||
return ((double) getData(24)) / 10; | ||
} | ||
|
||
@Override | ||
public short getInverterTemperature1() { | ||
return getData(26); | ||
} | ||
|
||
@Override | ||
public short getInverterTemperature2() { | ||
return getData(27); | ||
} | ||
|
||
@Override | ||
public short getTotalOutputPower() { | ||
return getData(78); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
...rc/main/java/org/openhab/binding/solax/internal/model/parsers/X3MicOrProG2DataParser.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/** | ||
* Copyright (c) 2010-2024 Contributors to the openHAB project | ||
* | ||
* See the NOTICE file(s) distributed with this work for additional | ||
* information. | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License 2.0 which is available at | ||
* http://www.eclipse.org/legal/epl-2.0 | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
*/ | ||
package org.openhab.binding.solax.internal.model.parsers; | ||
|
||
import static org.openhab.binding.solax.internal.SolaxBindingConstants.*; | ||
|
||
import java.util.Set; | ||
|
||
import org.eclipse.jdt.annotation.NonNullByDefault; | ||
import org.openhab.binding.solax.internal.connectivity.rawdata.LocalConnectRawDataBean; | ||
import org.openhab.binding.solax.internal.model.InverterData; | ||
import org.openhab.binding.solax.internal.model.impl.X3MicOrProG2InverterData; | ||
|
||
/** | ||
* The {@link X3MicOrProG2DataParser} is the implementation that parses raw data into a SinglePhaseInverterData for the | ||
* X3 Mic / Pro G2 inverter. | ||
* | ||
* @author Henrik Tóth - Initial contribution | ||
* (based on X1/X3 G4 parser from Konstantin Polihronov) | ||
*/ | ||
@NonNullByDefault | ||
public class X3MicOrProG2DataParser implements RawDataParser { | ||
|
||
private static final Set<String> X3_MIC_OR_PRO_G2_SUPPORTED_CHANNELS = Set.of( | ||
CHANNEL_INVERTER_OUTPUT_VOLTAGE_PHASE1, CHANNEL_INVERTER_OUTPUT_FREQUENCY_PHASE2, | ||
CHANNEL_INVERTER_OUTPUT_VOLTAGE_PHASE3, CHANNEL_INVERTER_OUTPUT_CURRENT_PHASE1, | ||
CHANNEL_INVERTER_OUTPUT_CURRENT_PHASE2, CHANNEL_INVERTER_OUTPUT_CURRENT_PHASE3, | ||
CHANNEL_INVERTER_OUTPUT_POWER_PHASE1, CHANNEL_INVERTER_OUTPUT_POWER_PHASE2, | ||
CHANNEL_INVERTER_OUTPUT_POWER_PHASE3, CHANNEL_INVERTER_PV1_VOLTAGE, CHANNEL_INVERTER_PV2_VOLTAGE, | ||
CHANNEL_INVERTER_PV1_CURRENT, CHANNEL_INVERTER_PV2_CURRENT, CHANNEL_INVERTER_PV1_POWER, | ||
CHANNEL_INVERTER_PV2_POWER, CHANNEL_INVERTER_OUTPUT_FREQUENCY_PHASE1, | ||
CHANNEL_INVERTER_OUTPUT_VOLTAGE_PHASE2, CHANNEL_INVERTER_OUTPUT_FREQUENCY_PHASE3, CHANNEL_TOTAL_ENERGY, | ||
CHANNEL_TODAY_ENERGY, CHANNEL_INVERTER_TOTAL_OUTPUT_POWER, CHANNEL_INVERTER_TEMPERATURE1, | ||
CHANNEL_INVERTER_TEMPERATURE2, CHANNEL_INVERTER_WORKMODE, CHANNEL_RAW_DATA); | ||
|
||
@Override | ||
public InverterData getData(LocalConnectRawDataBean rawData) { | ||
return new X3MicOrProG2InverterData(rawData); | ||
} | ||
|
||
@Override | ||
public Set<String> getSupportedChannels() { | ||
return X3_MIC_OR_PRO_G2_SUPPORTED_CHANNELS; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.