-
-
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
[ism8] Add UoM support #14206
[ism8] Add UoM support #14206
Conversation
Signed-off-by: lsiepel <[email protected]>
Signed-off-by: lsiepel <[email protected]>
Signed-off-by: lsiepel <[email protected]>
Signed-off-by: lsiepel <[email protected]>
Signed-off-by: lsiepel <[email protected]>
As this is a breaking change, did you think of adding a note to update.lst in distro repo? |
add breaking change alert for ISM8 related to: openhab/openhab-addons#14206
Yeah, thought about it, never done that before, hope it is right. |
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.
Looks good for the docs part.
Wanted to add the |
There is no documentation: openhab/openhab-core#3330 (comment) A few sources for information: |
Now there is: https://next.openhab.org/docs/developer/bindings/thing-xml.html#updating-thing-types |
Oke, i have read some more and used it elsewhere. So i can understand the basics, but now this binding is different, it adds the channels during setup dynamically. I have this problem with the following scenario: If not, this PR is ready to review/merge and the breaking change PR will still be needed. Edit: @jlaur would be nice if you can advice on how to proceed with the upgrade instructions. As there is not a 1:1 relation between old and new channels-types. |
@openhab/add-ons-maintainers This PR has been tested and confirmed to be working as expected. Can we get this merged? |
Seen some other PR's and for those cases when channels where automatically added the thing upgrade was not needed. So i think this is all set now. |
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 a review, sorry, but I noticed two old comments pending, so thought I'd "flush" them. 🙂
...openhab.binding.ism8/src/main/java/org/openhab/binding/ism8/internal/util/Ism8DomainMap.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Leo Siepel <[email protected]>
Signed-off-by: Leo Siepel <[email protected]>
Signed-off-by: Leo Siepel <[email protected]>
@openhab/add-ons-maintainers It would be nice to have this available in 4.2 M1 Anyone able to review ? |
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 - just some minor comments.
/** | ||
* Channel id configuration parameter | ||
* | ||
*/ |
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.
/** | |
* Channel id configuration parameter | |
* | |
*/ |
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.
Done
|
||
@Override | ||
public void handleCommand(ChannelUID channelUID, Command command) { | ||
this.logger.debug("Ism8: Handle command = {} {}", channelUID.getId(), command); |
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.
this.logger.debug("Ism8: Handle command = {} {}", channelUID.getId(), command); | |
logger.debug("Ism8: Handle command = {} {}", channelUID.getId(), command); |
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.
Done
return true; | ||
} | ||
} catch (NumberFormatException e) { | ||
this.logger.warn( |
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.
this.logger.warn( | |
logger.warn( |
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.
Done
description, config); | ||
} | ||
} else { | ||
this.logger.debug("Ism8: ID or type missing - Channel={} Cfg={}", description, config); |
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.
this.logger.debug("Ism8: ID or type missing - Channel={} Cfg={}", description, config); | |
logger.debug("Ism8: ID or type missing - Channel={} Cfg={}", description, config); |
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.
Done
try { | ||
svr.sendData(Ism8DomainMap.toISM8WriteData(dataPoint, command)); | ||
} catch (IOException e) { | ||
this.logger.debug("Writting to Ism8 DataPoint '{}' failed. '{}'", dataPoint.getId(), 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.
this.logger.debug("Writting to Ism8 DataPoint '{}' failed. '{}'", dataPoint.getId(), e.getMessage()); | |
logger.debug("Writing to Ism8 DataPoint '{}' failed. '{}'", dataPoint.getId(), 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.
Done
e.getMessage()); | ||
} | ||
} else { | ||
this.logger.debug("Ism8: ID or type missing - Channel={} Cfg={}", channel.getLabel(), |
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.
this.logger.debug("Ism8: ID or type missing - Channel={} Cfg={}", channel.getLabel(), | |
logger.debug("Ism8: ID or type missing - Channel={} Cfg={}", channel.getLabel(), |
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.
Done
int id = Integer.parseInt(channel.getConfiguration().get(CHANNEL_CONFIG_ID).toString()); | ||
if (id == dataPoint.getId()) { | ||
if (dataPoint.getValueObject() != null) { | ||
this.logger.debug("Ism8: updating channel {} with datapoint: {}", channel.getUID().getAsString(), |
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.
this.logger.debug("Ism8: updating channel {} with datapoint: {}", channel.getUID().getAsString(), | |
logger.debug("Ism8: updating channel {} with datapoint: {}", channel.getUID().getAsString(), |
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.
Done
return true; | ||
} | ||
} else { | ||
this.logger.debug("Ism8 channel: {} and DataPoint do not have a matching Id: {} vs {}", |
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.
this.logger.debug("Ism8 channel: {} and DataPoint do not have a matching Id: {} vs {}", | |
logger.debug("Ism8 channel: {} and DataPoint do not have a matching Id: {} vs {}", |
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.
Done
channel.getUID(), id, dataPoint.getId()); | ||
} | ||
} catch (NumberFormatException e) { | ||
this.logger.warn( |
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.
this.logger.warn( | |
logger.warn( |
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.
Done
} | ||
} | ||
} | ||
this.logger.debug("Ism8: no channel was found for DataPoint id: {}", dataPoint.getId()); |
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.
this.logger.debug("Ism8: no channel was found for DataPoint id: {}", dataPoint.getId()); | |
logger.debug("Ism8: no channel was found for DataPoint id: {}", dataPoint.getId()); |
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.
Done
Signed-off-by: Leo Siepel <[email protected]>
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!
* Add UoM support Signed-off-by: lsiepel <[email protected]> Signed-off-by: Jørgen Austvik <[email protected]>
* Add UoM support Signed-off-by: lsiepel <[email protected]>
Signed-off-by: lsiepel [email protected]
Due to the change in channels, this is not backwards compatible. Channel configuration and linked Items have to be adapted.
Test jar for 3.4.1 is available here: https://1drv.ms/u/s!AnMcxmvEeupwjp4L347Q22cnMI1QQg?e=ROo8Y1
Tests have been performed by @schmidmuc (thanks for that!)
Fixes: #9598
Also replaces: #14665