Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[solax] Initial contribution #14880

Merged
merged 34 commits into from
Aug 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
4b938df
Squashed all commits
theater Apr 11, 2023
731b1d9
Change version in pom.xml to 4.1.0
theater Jul 25, 2023
d5d90a4
Metadata and README requested changes
theater Jul 26, 2023
3c0e58a
Changes in the handlers, factory and discovery service from the review
theater Jul 26, 2023
2aedbf0
Update bundles/org.openhab.binding.solax/README.md
theater Jul 26, 2023
ad8c370
Update bundles/org.openhab.binding.solax/src/main/resources/OH-INF/th…
theater Jul 26, 2023
6d8592c
Changes in channel types, readme and null pointer checks warnings
theater Jul 26, 2023
f1c2232
Remove the bridge and use only a thing / thing handler
theater Jul 26, 2023
d418205
Fix README - the examples and the bridge/thing changes
theater Jul 26, 2023
b5f8028
Fixed a typo in logging and renamed some constants
theater Jul 26, 2023
f87a71d
Fixes from the review (see details)
theater Jul 26, 2023
3f91205
Fix mvn warning and a pointer cleanup in dispose method
theater Jul 27, 2023
f9d1340
Refactored the exception handling of JSON parse. Please review
theater Jul 27, 2023
7c3a25b
Update bundles/org.openhab.binding.solax/README.md
theater Jul 27, 2023
d91bf38
Update bundles/org.openhab.binding.solax/README.md
theater Jul 27, 2023
afb926b
Update bundles/org.openhab.binding.solax/README.md
theater Jul 27, 2023
bfeb0cd
Update bundles/org.openhab.binding.solax/README.md
theater Jul 27, 2023
1ddfd33
Update bundles/org.openhab.binding.solax/README.md
theater Jul 27, 2023
f2fe3f8
Update bundles/org.openhab.binding.solax/README.md
theater Jul 27, 2023
342c685
Fix retrieveData method in local connector to return nullable
theater Jul 27, 2023
f6327aa
Fixes in the metadata files
theater Jul 27, 2023
81c45ef
Format the tables and remove channels from inverter description
theater Jul 27, 2023
6895cc5
Fixes from the review
theater Jul 28, 2023
b6c65a2
Fixes (see below)
theater Aug 9, 2023
2d76fd6
Update bundles/org.openhab.binding.solax/src/main/resources/OH-INF/th…
theater Aug 16, 2023
26194dc
Update bundles/org.openhab.binding.solax/src/main/resources/OH-INF/th…
theater Aug 16, 2023
fa79089
Recreate translations
theater Aug 16, 2023
1048e09
Update bundles/org.openhab.binding.solax/README.md
theater Aug 17, 2023
baf92ca
Update bundles/org.openhab.binding.solax/README.md
theater Aug 17, 2023
44a084a
Update bundles/org.openhab.binding.solax/pom.xml
theater Aug 18, 2023
3fb3fc0
Fix prio3 errors
theater Aug 18, 2023
9cba0d1
Fix build warnings
theater Aug 21, 2023
1e35b5c
Update bundles/org.openhab.binding.solax/src/main/java/org/openhab/bi…
theater Aug 24, 2023
6e17a14
Update bundles/org.openhab.binding.solax/src/main/java/org/openhab/bi…
theater Aug 24, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,7 @@
/bundles/org.openhab.binding.solarlog/ @johannrichard
/bundles/org.openhab.binding.solarmax/ @jamietownsend
/bundles/org.openhab.binding.solarwatt/ @sven-carstens
/bundles/org.openhab.binding.solax/ @theater
/bundles/org.openhab.binding.somfymylink/ @loungeflyz
/bundles/org.openhab.binding.somfytahoma/ @octa22
/bundles/org.openhab.binding.somneo/ @0x4d4d
Expand Down
5 changes: 5 additions & 0 deletions bom/openhab-addons/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1606,6 +1606,11 @@
<artifactId>org.openhab.binding.solarwatt</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.openhab.addons.bundles</groupId>
<artifactId>org.openhab.binding.solax</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.openhab.addons.bundles</groupId>
<artifactId>org.openhab.binding.somfymylink</artifactId>
Expand Down
13 changes: 13 additions & 0 deletions bundles/org.openhab.binding.solax/NOTICE
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
This content is produced and maintained by the openHAB project.

* Project home: https://www.openhab.org

== Declared Project Licenses

This program and the accompanying materials are made available under the terms
of the Eclipse Public License 2.0 which is available at
https://www.eclipse.org/legal/epl-2.0/.

== Source Code

https://github.com/openhab/openhab-addons
189 changes: 189 additions & 0 deletions bundles/org.openhab.binding.solax/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,189 @@
# Solax Binding

This is a binding for Solax solar power inverters.

Solax Wi-Fi module with direct connection via HTTP is supported.
Wi-Fi module firmware version 3.x+ is required.
Please note that earlier firmware releases do not support direct connection, therefore the binding will not work in its current state.

The binding retrieves a structured data from the inverter's Wi-Fi module, parses it and pushes it into the inverter Thing where each channel represents a specific information (inverter output power, voltage, PV1 power, etc.)

theater marked this conversation as resolved.
Show resolved Hide resolved
In case the parsed information that comes with the binding out of the box differs, the raw data channel can be used with a combination of JSON Path transformation to map the proper values to the necessary items.

theater marked this conversation as resolved.
Show resolved Hide resolved
## Supported Things
theater marked this conversation as resolved.
Show resolved Hide resolved

| Thing | Thing Type | Description |
|------------------------|------------|-------------------------------------------------------------------------------------|
| local-connect-inverter | Thing | This is model representation of inverter with all the data available as a channels |

## Thing Configuration

### Local Connect Inverter Configuration

| Parameter | Description |
|-------------------|----------------------------------------------------------------------------------------------------------------------------------------------------|
| refreshInterval | Defines the refresh interval when the binding polls from the inverter's Wi-Fi module (in seconds). Optional parameter. Default 10 seconds. |
| password | Password for accessing the Wi-Fi module (the serial number of the wifi). Mandatory parameter. |
| hostname | IP address or hostname of your Wi-Fi module. If hostname is used must be resolvable by OpenHAB. Mandatory parameter. |

### Inverter Output Channels

| Channel | Type | Description |
|--------------------------|----------------------------|--------------------------------------------------|
| inverter-output-power | Number:Power | The output power of the inverter [W] |
| inverter-current | Number:ElectricCurrent | The output current of the inverter [A] |
| inverter-voltage | Number:ElectricPotential | The output voltage of the inverter [V] |
| inverter-frequency | Number:Frequency | The frequency of the output voltage [Hz] |

### Photovoltaic Panels Production Channels

| Channel | Type | Description |
|--------------------------|----------------------------|-------------------------------------------------|
| pv1-voltage | Number:ElectricPotential | The voltage of PV1 string [V] |
| pv2-voltage | Number:ElectricPotential | The voltage of PV2 string [V] |
| pv1-current | Number:ElectricCurrent | The current of PV1 string [A] |
| pv2-current | Number:ElectricCurrent | The current of PV2 string [A] |
| pv1-power | Number:Power | The output power PV1 string [W] |
| pv2-power | Number:Power | The output power PV2 string [W] |
| pv-total-power | Number:Power | The total output power of both PV strings [W] |
| pv-total-current | Number:ElectricCurrent | The total current of both PV strings [A] |

### Battery channels

| Channel | Type | Description |
|---------------------------|----------------------------|------------------------------------------------------------------------------------------------|
| battery-power | Number:Power | The power to / from battery (negative means power is pulled from battery and vice-versa) [W] |
| battery-current | Number:ElectricCurrent | The current to / from battery (negative means power is pulled from battery and vice-versa) [A] |
| battery-voltage | Number:ElectricPotential | The voltage of the battery [V] |
| battery-temperature | Number:Temperature | The temperature of the battery [C/F] |
| battery-state-of-charge | Number | The state of charge of the battery [%] |

### Grid related channels

| Channel | Type | Description |
theater marked this conversation as resolved.
Show resolved Hide resolved
|--------------------------|----------------------------|------------------------------------------------------------------------------------------------|
| feed-in-power | Number:Power | The power to / from grid (negative means power is pulled from the grid and vice-versa) [W] |

### General channels

| Channel | Type | Description |
|--------------------------|----------------------------|---------------------------------------------------------------------------------------------------------------------------------------------|
| last-update-time | DateTime | Last time when a call has been made to the inverter |
| raw-data | String | The raw data retrieved from inverter in JSON format. (Usable for channels not implemented. Can be consumed with the JSONpath transformation |

### Properties
theater marked this conversation as resolved.
Show resolved Hide resolved

| Property | Description |
|-------------------|-------------------------------------------|
| serialNumber | The serial number of the Wi-Fi module |
| inverterType | Inverter Type (for example X1_HYBRID_G4) |

theater marked this conversation as resolved.
Show resolved Hide resolved
## Full Example

Here are some file based examples.

### Thing Configuration

```java
// The local connect inverter thing
Thing solax:local-connect-inverter:localInverter [ refreshInterval=10, password="<SERIAL NUMBER OF THE WIFI MODULE>", hostname="<local IP/hostname in the network>" ]
```

### Item Configuration

```java
Group gSolaxInverter "Solax Inverter" <energy> (boilerRoom)
Group solarPanels "Solar panels" <energy> (gSolaxInverter)

Number solaxPowerWest "West [%.0f W]" <solarplant> (gsolax_inverter,EveryChangePersist,solarPanels){ channel="solax:localConnectInverter:localInverter:pv1-power" }
Number solaxPowerEast "East [%.0f W]" <solarplant> (gsolax_inverter,EveryChangePersist,solarPanels){ channel="solax:localConnectInverter:localInverter:pv2-power" }
Number solaxBatteryPower "Battery power [%.0f W]" <energy> (gsolax_inverter,EveryChangePersist) { channel="solax:localConnectInverter:localInverter:battery-power" }
Number solaxBatterySoc "Battery SoC [%.0f %%]" <batterylevel> (gsolax_inverter,EveryChangePersist) { channel="solax:localConnectInverter:localInverter:battery-state-of-charge" }

Number solaxFeedInPower "Feed-in power (CEZ) [%.0f W]" <energy> (gsolax_inverter,EveryChangePersist) { channel="solax:localConnectInverter:localInverter:feed-in-power" }
Number solaxAcPower "Invertor output power [%.0f W]" <energy> (gsolax_inverter,EveryChangePersist){ channel="solax:localConnectInverter:localInverter:inverter-output-power" }

String solaxInverterType "Inverter Type [%s]" <energy> (gsolax_inverter) { channel="solax:localConnectInverter:localInverter:inverter-type"}
String solaxUploadTime "Last update time [%s]" <calendar> (gsolax_inverter) { channel="solax:localConnectInverter:localInverter:last-update-time" }
String solaxRawData "Raw data [%s]" <data> (gsolax_inverter) { channel="solax:localConnectInverter:localInverter:raw-data" }
```

### Sitemap Configuration

```perl
Frame label="Solar power strings" {
Text item=solaxPowerEast valuecolor=[<=30="gray",<=300="red", <1500="orange", >=1500="green"] {
Text item=solaxPowerEast icon="energy" valuecolor=[<=30="gray",<=300="red", <1500="orange", >=1500="green"]
Text item=solaxPowerWest icon="energy" valuecolor=[<=30="gray",<=300="red", <1500="orange", >=1500="green"]
Switch item=Chart_Period label="Chart Period" mappings=[0="H", 1="D", 2="W", 3="M", 4="Y"]
Chart item=solarPanels period=h refresh=600 visibility=[Chart_Period==0]
Chart item=solarPanels period=D refresh=3600 visibility=[Chart_Period==1]
Chart item=solarPanels period=W refresh=3600 visibility=[Chart_Period==2, Chart_Period==Uninitialized]
Chart item=solarPanels period=M refresh=3600 visibility=[Chart_Period==3]
Chart item=solarPanels period=Y refresh=3600 visibility=[Chart_Period==4]
}
Text item=solaxPowerWest valuecolor=[<=30="gray",<=300="red", <1500="orange", >=1500="green"] {
Text item=solaxPowerEast icon="energy" valuecolor=[<=30="gray",<=300="red", <1500="orange", >=1500="green"]
Text item=solaxPowerWest icon="energy" valuecolor=[<=30="gray",<=300="red", <1500="orange", >=1500="green"]
Switch item=Chart_Period label="Chart Period" mappings=[0="H", 1="D", 2="W", 3="M", 4="Y"]
Chart item=solarPanels period=h refresh=600 visibility=[Chart_Period==0]
Chart item=solarPanels period=D refresh=3600 visibility=[Chart_Period==1]
Chart item=solarPanels period=W refresh=3600 visibility=[Chart_Period==2, Chart_Period==Uninitialized]
Chart item=solarPanels period=M refresh=3600 visibility=[Chart_Period==3]
Chart item=solarPanels period=Y refresh=3600 visibility=[Chart_Period==4]
}
Text item=solaxGenerationTotal valuecolor=[<=100="gray",<=500="red", <2000="orange", >=2000="green"] {
Text item=solaxPowerEast icon="energy" valuecolor=[<=30="gray",<=300="red", <1500="orange", >=1500="green"]
Text item=solaxPowerWest icon="energy" valuecolor=[<=30="gray",<=300="red", <1500="orange", >=1500="green"]
Text item=solaxGenerationTotal icon="energy" valuecolor=[<=30="gray",<=300="red", <1500="orange", >=1500="green"]
Switch item=Chart_Period label="Chart Period" mappings=[0="H", 1="D", 2="W", 3="M", 4="Y"]
Chart item=solarPanels period=h refresh=600 visibility=[Chart_Period==0]
Chart item=solarPanels period=D refresh=3600 visibility=[Chart_Period==1]
Chart item=solarPanels period=W refresh=3600 visibility=[Chart_Period==2, Chart_Period==Uninitialized]
Chart item=solarPanels period=M refresh=3600 visibility=[Chart_Period==3]
Chart item=solarPanels period=Y refresh=3600 visibility=[Chart_Period==4]
}
}
Frame label="Consumption" {
Text item=solaxAcPower valuecolor=[<=30="gray", <800="green", <1500="orange", >=1500="red"] {
Switch item=Chart_Period label="Chart Period" mappings=[0="H", 1="D", 2="W", 3="M", 4="Y"]
Text item=solaxAcPower icon="energy" valuecolor=[<=30="gray", <800="green", <1500="orange", >=1500="red"]
Chart item=solaxAcPower period=h refresh=600 visibility=[Chart_Period==0]
Chart item=solaxAcPower period=D refresh=3600 visibility=[Chart_Period==1]
Chart item=solaxAcPower period=W refresh=3600 visibility=[Chart_Period==2, Chart_Period==Uninitialized]
Chart item=solaxAcPower period=M refresh=3600 visibility=[Chart_Period==3]
Chart item=solaxAcPower period=Y refresh=3600 visibility=[Chart_Period==4]
}
Text item=solaxFeedInPower valuecolor=[<=30="gray", <800="green", <1500="orange", >=1500="red"] {
Switch item=Chart_Period label="Chart Period" mappings=[0="H", 1="D", 2="W", 3="M", 4="Y"]
Text item=solaxFeedInPower icon="energy" valuecolor=[<=30="gray", <800="green", <1500="orange", >=1500="red"]
Chart item=solaxFeedInPower period=h refresh=600 visibility=[Chart_Period==0]
Chart item=solaxFeedInPower period=D refresh=3600 visibility=[Chart_Period==1]
Chart item=solaxFeedInPower period=W refresh=3600 visibility=[Chart_Period==2, Chart_Period==Uninitialized]
Chart item=solaxFeedInPower period=M refresh=3600 visibility=[Chart_Period==3]
Chart item=solaxFeedInPower period=Y refresh=3600 visibility=[Chart_Period==4]
}
}
Frame label="Battery" {
Text item=solaxBatteryPower valuecolor=[<=-500="red", <0="orange", ==0="gray", >0="green"] {
Switch item=Chart_Period label="Chart Period" mappings=[0="H", 1="D", 2="W", 3="M", 4="Y"]
Text item=solaxBatteryPower icon="energy" valuecolor=[<-800="red", <0="orange", ==0="gray", >=0="green"]
Chart item=solaxBatteryPower period=h refresh=600 visibility=[Chart_Period==0]
Chart item=solaxBatteryPower period=D refresh=3600 visibility=[Chart_Period==1]
Chart item=solaxBatteryPower period=W refresh=3600 visibility=[Chart_Period==2, Chart_Period==Uninitialized]
Chart item=solaxBatteryPower period=M refresh=3600 visibility=[Chart_Period==3]
Chart item=solaxBatteryPower period=Y refresh=3600 visibility=[Chart_Period==4]
}
Text item=solaxBatterySoc valuecolor=[<=30="red", <50="orange", >=50="green"] {
Switch item=Chart_Period label="Chart Period" mappings=[0="H", 1="D", 2="W", 3="M", 4="Y"]
Text item=solaxBatterySoc valuecolor=[<=30="red", <50="orange", >=50="green"]
Chart item=solaxBatterySoc period=h refresh=600 visibility=[Chart_Period==0]
Chart item=solaxBatterySoc period=D refresh=3600 visibility=[Chart_Period==1]
Chart item=solaxBatterySoc period=W refresh=3600 visibility=[Chart_Period==2, Chart_Period==Uninitialized]
Chart item=solaxBatterySoc period=M refresh=3600 visibility=[Chart_Period==3]
Chart item=solaxBatterySoc period=Y refresh=3600 visibility=[Chart_Period==4]
}
}
```


17 changes: 17 additions & 0 deletions bundles/org.openhab.binding.solax/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">

<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.openhab.addons.bundles</groupId>
<artifactId>org.openhab.addons.reactor.bundles</artifactId>
<version>4.1.0-SNAPSHOT</version>
</parent>

<artifactId>org.openhab.binding.solax</artifactId>

<name>openHAB Add-ons :: Bundles :: Solax Binding</name>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<features name="org.openhab.binding.solax-${project.version}" xmlns="http://karaf.apache.org/xmlns/features/v1.4.0">
<repository>mvn:org.openhab.core.features.karaf/org.openhab.core.features.karaf.openhab-core/${ohc.version}/xml/features</repository>

<feature name="openhab-binding-solax" description="solax Binding" version="${project.version}">
<feature>openhab-runtime-base</feature>
<bundle start-level="80">mvn:org.openhab.addons.bundles/org.openhab.binding.solax/${project.version}</bundle>
</feature>
</features>
Loading