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

[siemenshvac] Initial contribution - interface (OZW672) #14263

Open
wants to merge 181 commits into
base: main
Choose a base branch
from

Conversation

lo92fr
Copy link

@lo92fr lo92fr commented Jan 22, 2023

Title

Add a binding for siemens Hvac interface (OZW672)

Description

This pull request is about adding a binding for siemens Hvac interface OZW672 (https://hit.sbt.siemens.com/RWD/app.aspx?rc=FR&lang=fr&module=Catalog&action=ShowProduct&key=BPZ:OZW672.01)

The OZW672 is a ethernet bridge for the LSB bus of Hvac device.
It implements a web interface that enable reading and setting of differents hvac parameters.
OZW672 also support a REST api.

This binding use this REST api to integrate OZW672 into openhab.

Testing

The binding support autodiscovery of the OZW672 interface using upnp.
After a few minutes, you should see the OZW672 bridge into your Inbox.
If not, power off and up OZW672.
You can also add the bridge manually.

After adding the bridge, you will have to go to bridge parameters, setting the password for the OZW672, and then restart openhab.
On restart, OZW672 will do autodiscovery phase from you installation during initialization.
This can be a little long : ~2 to 5 minutes depending of your installation.

After OZW672 bridge come up again, go back again to the "things" page of openhab.
Click on the add button, then click on the "siemensHvac" binding, and on the next page click on the "scan" button.
After a few second, openhab should list all you devices connect to the LSB bus.
If you have a simple home Hvac installation, it will generally find only one device.
Most common name for this device are something like "RVS41xxx.yyy".
This device represents the main controler inside your Hvac device.

After you add this RVS to your system, you can go into it, and Channels tabs will expose all your hvac settings.
Structure of the Channels should be the same as the one on the LCD screen of your Hvac device.
You may have a lot more of items that on your LCD screen because the device exposte all items, even the one for "specialist" guys.

@lo92fr lo92fr requested a review from a team as a code owner January 22, 2023 19:28
@lo92fr lo92fr force-pushed the 14262-siemensHvac branch 2 times, most recently from dc1076f to 737f2f3 Compare January 22, 2023 19:41
@lo92fr
Copy link
Author

lo92fr commented Jan 22, 2023

Hello,

Not sure to understand the error message on the build.
The compilation is working on my side, if you can give me some advice about this error.

@lsiepel lsiepel changed the title Add a binding for siemens Hvac interface (OZW672) [siemenshvac] Initial contribution - interface (OZW672) Jan 22, 2023
@lsiepel lsiepel added new binding If someone has started to work on a binding. For a new binding PR. rebuild Triggers Jenkins PR build and removed rebuild Triggers Jenkins PR build labels Jan 22, 2023
@lsiepel
Copy link
Contributor

lsiepel commented Jan 23, 2023

Hope the rebuild helps, don't see anything obvious wrong with the POM etc. You might want to look at the readme.md and the i18n files as they seem to be just the placeholders.

@lsiepel lsiepel linked an issue Jan 24, 2023 that may be closed by this pull request
Copy link
Contributor

@clinique clinique left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Partial review

Copy link
Contributor

@clinique clinique left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Partial review.

@lo92fr
Copy link
Author

lo92fr commented Jan 24, 2023

Hello Gael,

Thanks for your review.
I've just updated the pull request with the requested modifications.

Laurent.

@lo92fr lo92fr force-pushed the 14262-siemensHvac branch 2 times, most recently from bc727ff to 66445a4 Compare January 24, 2023 18:50
@lo92fr
Copy link
Author

lo92fr commented Jan 24, 2023

I also manage to fix the build.
Was missing a reference in bom/openhab-addons/pom.xml.

Laurent.

Copy link
Contributor

@clinique clinique left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Second review

@freichen
Copy link

freichen commented Apr 4, 2023

@lo92fr Amazing binding - thank you ! I tested it with an OZW672.01 connected to a RVP350 and the only issue I found was that Enumeration channels are auto-discovered as Number - for example:

image

@lo92fr
Copy link
Author

lo92fr commented Apr 16, 2023

hannels are auto-discovered as Number - for example:

Hello Freichen,

Not sure what are the good way to fix this.
Do you have some guidlines, or some other example binding I can look to fix this.

@lo92fr
Copy link
Author

lo92fr commented Apr 16, 2023

Hello Gaël,

@clinique : I'm not sure what are the current state of this pull request.
Do you wait more change from my side ?

@larnalcegid
Copy link

Hello,

Can some one can give an update about the integration of this pull request in main stream.

Thanks,
Laurent.

@larnalcegid
Copy link

@lo92fr Amazing binding - thank you ! I tested it with an OZW672.01 connected to a RVP350 and the only issue I found was that Enumeration channels are auto-discovered as Number - for example:

image

I've commit a fix for this, should be working as excepted now.

@larnalcegid
Copy link

Hello Gaël, Hello Freichen,

Any update on this ?
Let me know if any more changed is need.

Laurent.

Signed-off-by: Laurent ARNAL <laurent@clae.net>
@lo92fr
Copy link
Author

lo92fr commented May 14, 2024

Hello Jacob (@jlaur ),

I commit a bunch of fixes this morning about your last review.
I also see your question about screenshoot f the discovered things.
So I've put some screenshoot and explanation on your comment.
Tell me if it's sufficient, or if you're need more explanation.

Laurent.

Signed-off-by: Laurent ARNAL <laurent@clae.net>
Signed-off-by: Laurent ARNAL <laurent@clae.net>
@lo92fr
Copy link
Author

lo92fr commented May 14, 2024

Freichen

Hello @freichen,

I don't know if you see my last message (#14263 (comment)).
Do you have the time to verify if removing the json fix the issue ?

Thanks,
Laurent.

Signed-off-by: Laurent ARNAL <laurent@clae.net>
result = result.replaceAll("\\p{M}", "");
}

result = result.replaceAll("[^a-zA-Z0-9_]", "_").toLowerCase();
Copy link
Contributor

@jlaur jlaur May 14, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I might have made a mistake in a previous suggestion based on the logic being replaced rather than the naming convention:

Suggested change
result = result.replaceAll("[^a-zA-Z0-9_]", "_").toLowerCase();
result = result.replaceAll("[^a-zA-Z0-9-]", "-").toLowerCase();

(not sure if "-" needs to be escaped, i.e. "[^a-zA-Z0-9\-]")

xsi:schemaLocation="https://openhab.org/schemas/thing-description/v1.0.0 https://openhab.org/schemas/thing-description-1.0.0.xsd">

<!-- Bridge Thing Type -->
<bridge-type id="ozw672">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was thinking about #14263 (comment) on my way to work and to provide some additional context. I then came also to think about the bridge type id. If the binding also works with OZW772.x, or might be brought to work with that as well, probably this id is too specialized. I'm thinking about two possible scenarios:

  • OZW772.x is very different code-wise and a new bridge type would have to be introduced.
  • OZW772.x is very similar code-wise, and it can be tweaked to work with the same bridge type, perhaps with some different configuration.

If actually it is expected to be similar, it would be strange to create a bridge type ozw672 for a OZW772.

My proposal in this case would be to rename to a more generic name, perhaps the common denominator "ozw"?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not really sure on that, as I don't have documentation about Ozw772, and don't have access to this physical device to do some test. But I except that the code should be identical between the two devices.

Today, in the binding, the only specific part is in bridge initialization / discovery where we test the modelName, and initialize an OZW672. Notes that in current configuration, we will not currently support Ozw772 because we don't have an SiemensHvacOZW772BridgeThingHandler override the SiemensHvacBridgeBaseThingHandler, and so we have no way to init the addon for this device.

So I think we can go two way :

  • Scenario 1: Keep like this for first version of the addon.
  • Scenario 2: extends the discovering and bridge initialization to handle OZW772, adding an SiemensHvacOZW772BridgeThingHandler override, and see if someone has the device to do some testing.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It sounds like you would expect OZW772 to be similar rather than different. The implementation and support can always be changed, but the modelling cannot without breaking backwards compatibility.

So I would propose to keep the current implementation, but generalize the bridge type id: ozw672ozw. I think in the long run it will then be easier to add support for OZW772 with less duplication (i.e. separate bridge definitions, handlers, etc.). It won't hurt to also rename SiemensHvacOZW772BridgeThingHandler etc., but strictly it's not necessary as it can always be refactored without breaking anything.

offline.waiting-bridge-initialization = Waiting bridge initialization, reading metadata in background

offline.baseurl-mandatory = baseUrl is mandatory on configuration !
offline.error-gateway-init = Error occurs during gateway initialization: %s
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
offline.error-gateway-init = Error occurs during gateway initialization: %s
offline.error-gateway-init = Error occurred during gateway initialization: {0}

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix on next commit

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One space too much slipped in between the words "occurred" and "during".

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix on next commit

}

LocalDateTime parsedDate = LocalDateTime.parse(value.getAsString(),
formatterBuilder.toFormatter(Locale.FRENCH));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this product only for the French market, or why do you need hardcoded French Locale here? Can you configure the OZW webserver language - if yes, how will such a change affect this method?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No it's a mistake, the product is international.

And you're right, changing the language on gateway side will influenced the result.
Mainly on formatter like this one "EEEE, d. LLLL yyyy HH:mm[:ss]" where the first part EEEE will be localized regarding the language setting of the gateway.

I take a look on how i can Handle this a better way

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've modify the code of TypeConverter to add the Local information as a parameter of fromBinding function.
This information is take from the MetadataRegistry which already contains the current user used to connect the API.
I handle there the language retrivial, and locale initialization.

Current gateway is supporting a bunch of different language: English,Deutsch,Francais,Italiano,Nederlands,Polski,Cesky,Magyar,Espanol,Dansk,Svenska,Suomi,Portugues,Russkij,Turkce,Slovensky;

I will certainly need to do more test to verify that formatter are ok for all this language.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow, that's a lot of languages to support. This reminds me of writing an integration for the old Miele@home Homebus API where essential information was provided as localized strings. It was a tremendous work to support that for the 4-5 languages supported by the gateway.

You might want to add to the README that depending on the configured language, there might be some issues which can then be reported (I suppose). You might want to prioritize to fully test and support at least a few of those languages besides French, for example English and German (considering the home of both Siemens and openHAB 😄).

@lo92fr
Copy link
Author

lo92fr commented May 31, 2024

Hello @jlaur,

I do a first pass on your review of May 15.
Sorry for the delay, but I was off for two weeks because of familly affair.

I still have to review the point about unit handling (your comment "For UoM support you would need to add dimension, i.e.").
I will try to fix this this morning.

Laurent.

@lo92fr lo92fr requested a review from jlaur May 31, 2024 08:26
Signed-off-by: Laurent ARNAL <laurent@clae.net>
Signed-off-by: Laurent ARNAL <laurent@clae.net>
fix locale initialization handling
review dimension initialization for NumberType
Fix TimeOfDay converter

Signed-off-by: Laurent ARNAL <laurent@clae.net>
@lo92fr
Copy link
Author

lo92fr commented Jun 2, 2024

Hello @jlaur,

I push the modification to handle UoM this morning.
After doing some more in depth test, I also realize that dimension initialization in MetadataRegistry was not properly handle.
I also fix this, and a few other things.

The addon now support the following dimensions on number:
Number:Temperature
Number:ElectricPotential
Number:Dimensionless
Number:Time

Laurent.

Signed-off-by: Laurent ARNAL <laurent@clae.net>
Signed-off-by: Laurent ARNAL <laurent@clae.net>

Mainly, it will first discover the gateway.
Currently test was done with the OZW672.x series.
No test was conduct using the OZW772.x series, the code will currently not handing initialization of OZW772 gateway.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
No test was conduct using the OZW772.x series, the code will currently not handing initialization of OZW772 gateway.
No test was conducted using the OZW772.x series, the code will currently not handle initialization of an OZW772 gateway.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix on next commit

Mainly, it will first discover the gateway.
Currently test was done with the OZW672.x series.
No test was conduct using the OZW772.x series, the code will currently not handing initialization of OZW772 gateway.
You can request support to the community forum is you have the gateway model and want it to be supported.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
You can request support to the community forum is you have the gateway model and want it to be supported.
You can request support in the community forum, if you have the gateway model and want it to be supported.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix on next commit

@jlaur
Copy link
Contributor

jlaur commented Jun 2, 2024

Sorry for the delay, but I was off for two weeks because of familly affair.

No worries, family is first priority. I will try to catch up in the next days.

I push the modification to handle UoM this morning.

Awesome!

Signed-off-by: Laurent ARNAL <laurent@clae.net>
fix initialization code to support OZW772

Signed-off-by: Laurent ARNAL <laurent@clae.net>
Signed-off-by: Laurent ARNAL <laurent@clae.net>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new binding If someone has started to work on a binding. For a new binding PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add a binding for siemens Hvac interface (OZW672)
8 participants