-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
[tacmi] Initial push of OpenHAB 2 ported tacmi binding #7768
Conversation
Travis tests have failedHey @marvkis, |
2 similar comments
Travis tests have failedHey @marvkis, |
Travis tests have failedHey @marvkis, |
Travis tests were successfulHey @marvkis, |
1 similar comment
Travis tests were successfulHey @marvkis, |
Travis tests have failedHey @marvkis, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for migrating this binding to OH2, really appreciate it! I know, many of the source code files you took over from the OH1 binding and some of them have legacy code which doesn't fit to our current coding guidelines. But this is the chance to clean up the old code and make a nice OH2 binding! So, I reviewed the whole code and here is my feedback.
The scaling of the picture sample-with-heating-circuit.png seems a bit large.
There are some checkstyle warnings left. You could take a look at target/code-analysis/report.html
.
There are some formatting issues. You can view them with mvn spotless:check -Dspotless.check.skip=false
and fix them with mvn spotless:apply
.
bundles/org.openhab.binding.tacmi/src/main/resources/ESH-INF/thing/bridge.xml
Outdated
Show resolved
Hide resolved
bundles/org.openhab.binding.tacmi/src/main/resources/ESH-INF/thing/thing-types.xml
Outdated
Show resolved
Hide resolved
bundles/org.openhab.binding.tacmi/src/main/resources/ESH-INF/thing/thing-types.xml
Outdated
Show resolved
Hide resolved
</channel-type> | ||
|
||
<thing-type id="cmiSchema" extensible="schema-switch-ro,schema-switch-rw,schema-numeric-ro,schema-state-ro"> | ||
<label>TA C.M.I. schema API connection</label> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Words in labels should be capitalized. See https://www.openhab.org/docs/developer/bindings/thing-xml.html#formatting-labels-and-descriptions
bom/openhab-addons/pom.xml
Outdated
<dependency> | ||
<groupId>org.openhab.addons.bundles</groupId> | ||
<artifactId>org.openhab.binding.cacmi</artifactId> | ||
<version>${project.version}</version> | ||
</dependency> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cacmi?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @fwolter ,
Thank's a lot for your Review! Sorry for the initial flood of messages, it's the first time I'm using github's review function.
I have some questions on some points, but the most of them sound clear and straight forward. I Hope I'll find the time next weekend to incorporate the changes into the code.
Would be great when you give me some hints on the things that are not clear !
Thanks a lot & Bye,
Chris
if (command instanceof RefreshType) { | ||
// this is not supported - we cannot pull states... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this would be possible. But from my observations theses Refresh-Messages only occur during startup when we don't have data received from the TA equipment. TA only sends data periodically or on change, but there is no known way of polling current values.
...hab.binding.tacmi/src/main/java/org/openhab/binding/tacmi/internal/schema/ApiPageParser.java
Show resolved
Hide resolved
// TODO how to debounce this? we could trigger refreshData() but during startup | ||
// this issues lots of requests... :-/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, I definitively have to have a look on the cache classes. I'm not aware of them.
setPodNumber(podNumber); | ||
} | ||
|
||
public abstract void debug(Logger logger); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good question. Is from the original binding. Might be stale - I already removed a bunch of stale methods. Will dig into it...
Travis tests were successfulHey @marvkis, |
1 similar comment
Travis tests were successfulHey @marvkis, |
Travis tests were successfulHey @marvkis, |
Hi @fwolter, I just pushed some updates. There are currently 3 open things left I'm aware:
Everything else should be done. I hope I got everything form your valuable review and applied it accordingly. Thanks & Bye, |
I didn't manage to fix the compiler error either. @openhab/add-ons-maintainers There is an overriden method from a non-annotated class. A String argument works fine, but the Map argument fails with "Illegal redefinition of parameter attributes, inherited method from AbstractSimpleMarkupHandler declares this parameter as 'Map<String,String>' (mismatching null constraints)". Here is the signature:
When using the raw type |
@marvkis Did you take a look at https://www.openhab.org/docs/configuration/persistence.html#restoring-item-states-on-restart ? You could leave it up to the user to configure this. Then, you don't need to handle it in the binding. |
Hi @fwolter , So, when using a external persistence it seems we have to find a way to update all channels 'at once'... I took me the time to open a post in the forum: https://community.openhab.org/t/channel-state-persistence-in-a-binding/103868 - I hope somebody will come up with a neat idea how to solve it ;) |
Hi @fwolter, how should we proceed on this point:
Shall I also open a thread in developers forum or shall we go without Thanks & Bye, |
You can disable the null check for the specific methods by annotating them with |
As the merge window for 2.5.9 comes closer and closer, do you want this get merged before OH3? |
Travis tests have failedHey @marvkis, |
Signed-off-by: Christian Niessner <[email protected]>
Signed-off-by: Christian Niessner <[email protected]>
…ing stuff... Signed-off-by: Christian Niessner <[email protected]>
fce64eb
to
ddf0e81
Compare
Travis tests were successfulHey @marvkis, |
Co-authored-by: Fabian Wolter <[email protected]> Signed-off-by: Christian Niessner <[email protected]>
…ging output, Exception handling Signed-off-by: Christian Niessner <[email protected]>
…xception improvements Signed-off-by: Christian Niessner <[email protected]>
ddf0e81
to
5f5bbed
Compare
Travis tests were successfulHey @marvkis, |
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.HANDLER_INITIALIZING_ERROR, "Error: " + e.getMessage()); | ||
this.online = false; | ||
} catch (final TimeoutException | ExecutionException e) { | ||
logger.warn("Error loading API Scheme: {} ", e.getMessage()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't need to log this, as updateStatus()
already does it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Damn, I didn't learn it. Sorry bothering you with this again... Having the logs from updateStatus()
I changed the level to debug for the parser errors so when the stack trace is needed the user has to enable debug logging...
Signed-off-by: Christian Niessner <[email protected]>
Travis tests were successfulHey @marvkis, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for migrating this binding to openHAB 2. I've done my review, mostly style improvements next to 3 main topics: Use of log to warn, use of specific detailed state information with state updates and suggestion about if you considered making type specific channels besides the generic output channel. These topics are covered in the review comments. The first 2 of these topcs cover multiple places, I haven't marked every occurrence.
...openhab.binding.tacmi/src/main/java/org/openhab/binding/tacmi/internal/coe/TACmiHandler.java
Outdated
Show resolved
Hide resolved
...openhab.binding.tacmi/src/main/java/org/openhab/binding/tacmi/internal/coe/TACmiHandler.java
Outdated
Show resolved
Hide resolved
} | ||
|
||
@Override | ||
@NonNullByDefault({}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NonNullByDefault should normally not be set on methods.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We had trouble finding a proper way to annotate the Map<>
in the (inherited) method definition properly with @Nullable
- all our testes ended with errors like "Illegal redefinition of parameter attributes, inherited method from AbstractSimpleMarkupHandler declares this parameter as 'Map<String,String>' (mismatching null constraints)". When you review the discussion here in the PR it was quite a topic. Key comments on this are here and here. If you have a better idea to solve this just enlighten me ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Regarding the map I suspect it might need to be some combination of Nullable placed somewhere:
@Nullable Map<@Nullable String, @Nullable String>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
...inding.tacmi/src/main/java/org/openhab/binding/tacmi/internal/schema/TACmiSchemaHandler.java
Outdated
Show resolved
Hide resolved
<parameter name="type" type="integer" min="0" max="21" required="true"> | ||
<label>Measurement Type</label> | ||
<description>Measurement type for this channel</description> | ||
<options> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you consider creating type specific channels for measurement type? Like a Number:Temperature
channel for value 1 type channels. That way the user can use it as an actual temperature channel.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not yet - but yes, it's quite obvious and sounds like a good idea. Would it be okay to do this in a later PR? I also plan to find out all "UNKNOWN" types from TACmiMeasureType.java to map to the real units. During this I also could create separate channels for all these different types.
…framework usage cleanups Co-authored-by: Hilbrand Bouwkamp <[email protected]> Signed-off-by: Christian Niessner <[email protected]>
Signed-off-by: Christian Niessner <[email protected]>
Signed-off-by: Christian Niessner <[email protected]>
3a1f227
to
92eb6cf
Compare
Travis tests were successfulHey @marvkis, |
Signed-off-by: Christian Niessner <[email protected]>
Travis tests were successfulHey @marvkis, |
Hi @Hilbrand I just reviewed my logger.warn messages. Set a bunch of it to .debug. I left messages as warn when they are related to communication errors and configuration problems on TA side. Is this okay? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Migrated from the openHAB 1 version. Signed-off-by: Christian Niessner <[email protected]>
Migrated from the openHAB 1 version. Signed-off-by: Christian Niessner <[email protected]>
Migrated from the openHAB 1 version. Signed-off-by: Christian Niessner <[email protected]>
Signed-off-by: Christian Niessner [email protected]
TA C.M.I. binding - ported legacy 1.xx addon to 2.xx
Hi. As I was helping a friend connecting his TA system with openhab we had some issues getting the old OpenHAB 1.xx addon to work and there have been some issues within the plugin itself I've started porting it to 2.xx.
Currently this binding should deliver all functionality as the 1.xx binding had with some additional bugfixing and removal of some limitations. Especially each output id should work and not only a few as the cave cat with bundled transfer of multiple values was solved by adding some internal caching so the binding is aware of the current values of the neighboring outputs and can send a complete set of updates.
I've uploaded a pre-compiled jar file to here for testing: https://github.com/marvkis/openhab-addons-dist/raw/master/org.openhab.binding.tacmi-2.5.6-SNAPSHOT.jar
And I've created a thread in the forum where the new version is announced and I asked for testing: https://community.openhab.org/t/tacmi-technische-alternative-ta-c-m-i-binding-upgrade-to-1-xx-2-xx/99416
I've marked the PR as WIP as I have some further idea's for this plugin. Never the less it should provide full functionality as the 1.xx version plugin had, so it might be an idea to merge this one as replacement for the 1.xx plugin and add the new ideas later on.
btw: I've developed this plugin via VSC as OpenHAB in eclipse kills my quite old 2015 mb (non-pro) - and i'm not sure if all formatting rules are applied correctly. So when you see issues here please give me the right pointers what & how to fix it.
Thanks & Bye,
Chris