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.
[modbus] Cleaned modbus binding + extension docs (openhab#7424)
* Cleaned modbus binding + extension Signed-off-by: Kai Kreuzer <kai@openhab.org> Signed-off-by: Eugen Freiter <freiter@gmx.de>
- Loading branch information
1 parent
f6eb251
commit ee1f22f
Showing
6 changed files
with
65 additions
and
92 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
## For Developers | ||
|
||
SunSpec is a big specification with many different type of devices. | ||
If you own or have access to an appliance that is not supported at the moment then your help is welcome. | ||
|
||
If you want to extend the bundle yourself, you have to do the followings: | ||
|
||
- Define your thing type, channel types and channel groups according to openHAB development practices. | ||
You can look at the meter and inverter types to get ideas how you can avoid repeating the same configuration over and over. | ||
|
||
- Extend the `AbstractSunSpecHandler` and implement the handlePolledData method. | ||
This method will be regularly called with the register data read from the appliance. | ||
The method should parse the data and update the channels with them. | ||
|
||
- The preferred way to parse the raw data is to write a parser for you model block type. | ||
Your class should implement the `SunspecParser` class and it is preferred to extend the `AbstractBaseParser` class. | ||
This base class has methods to accurately extract fields from the register array. | ||
|
||
- The parser should only retrieve the data from the register array and return them in a block descriptor class. | ||
Scaling and other higher level transformation should be done by the handler itself. | ||
|
||
- To include your block type in auto discovery you have to add its id to the `SUPPORTED_THING_TYPES_UIDS` map in `SunSpecConstants`. This is enough for our discovery process to include your thing type in the results. |
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
7 changes: 4 additions & 3 deletions
7
bundles/org.openhab.binding.modbus.sunspec/src/main/feature/feature.xml
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 |
---|---|---|
@@ -1,10 +1,11 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<features name="org.openhab.binding.modbus.sunspec-${project.version}" xmlns="http://karaf.apache.org/xmlns/features/v1.4.0"> | ||
<repository>file:${basedirRoot}/bundles/org.openhab.binding.modbus/target/feature/feature.xml</repository> | ||
<repository>file:${basedirRoot}/bundles/org.openhab.io.transport.modbus/target/feature/feature.xml</repository> | ||
|
||
<feature name="openhab-binding-modbus-sunspec" description="SunSpec Bundle" version="${project.version}"> | ||
<feature name="openhab-binding-modbus-sunspec" description="Modbus Binding SunSpec" version="${project.version}"> | ||
<feature>openhab-runtime-base</feature> | ||
<feature>openhab-binding-modbus</feature> | ||
<feature>openhab-transport-modbus</feature> | ||
<bundle start-level="80">mvn:org.openhab.addons.bundles/org.openhab.binding.modbus/${project.version}</bundle> | ||
<bundle start-level="80">mvn:org.openhab.addons.bundles/org.openhab.binding.modbus.sunspec/${project.version}</bundle> | ||
</feature> | ||
</features> |
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