-
-
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
[homewizard] Add current, voltage and failure channels #16995
Conversation
Signed-off-by: Leo Siepel <leosiepel@gmail.com>
Signed-off-by: Leo Siepel <leosiepel@gmail.com>
Signed-off-by: Leo Siepel <leosiepel@gmail.com>
Signed-off-by: Leo Siepel <leosiepel@gmail.com>
Signed-off-by: Leo Siepel <leosiepel@gmail.com>
Would be nice if we can get this merged, then it would be easier to move #13495 forward. |
Signed-off-by: Leo Siepel <leosiepel@gmail.com>
Signed-off-by: Leo Siepel <leosiepel@gmail.com>
Signed-off-by: Leo Siepel <leosiepel@gmail.com>
Got a little bit messy because of the merge conflicts. But all should be ok now. Ready for a review. Was tested by community and unit tests. |
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 the new channels! I have added a few comments.
.../src/main/java/org/openhab/binding/homewizard/internal/handler/HomeWizardP1MeterHandler.java
Show resolved
Hide resolved
try { | ||
return ZonedDateTime.of(year, month, day, hours, minutes, seconds, 0, ZoneId.systemDefault()); | ||
} catch (DateTimeException e) { | ||
LoggerFactory.getLogger(DataPayload.class).warn("Unable to parse Gas timestamp: {}", gasTimestamp); |
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.
I'm not sure we should log from a DTO get method. Perhaps this could be logged in the handler instead (even if this would require a getter for the raw value to be logged)?
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.
Moved logging to the handler.
thing-type.homewizard.energy_socket.label = HomeWizard Energysocket | ||
thing-type.homewizard.energy_socket.description = This thing provides the measurement data that is available through the http interface of a HomeWizard Energysocket. |
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 seems duplicated from the next two lines?
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.
Result of duplice thing declaration, fixed.
thing-type.config.homewizard.energy_socket.ipAddress.label = Network Address | ||
thing-type.config.homewizard.energy_socket.ipAddress.description = The IP or host name of the Energysocket. |
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.
Duplicated.
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.
Result of duplice thing declaration, fixed.
thing-type.config.homewizard.energy_socket.refreshDelay.label = Refresh Interval | ||
thing-type.config.homewizard.energy_socket.refreshDelay.description = The refresh interval in seconds for polling the Energysocket. |
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.
Duplicated.
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.
Result of duplice thing declaration, fixed.
thing-type.config.homewizard.watermeter.ipAddress.label = Network Address | ||
thing-type.config.homewizard.watermeter.ipAddress.description = The IP or host name of the Watermeter. | ||
thing-type.config.homewizard.watermeter.refreshDelay.label = Refresh Interval | ||
thing-type.config.homewizard.watermeter.refreshDelay.description = The refresh interval in seconds for polling the Watermeter. |
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.
Duplicated.
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.
Result of duplice thing declaration, fixed.
<label>Active Voltage L3</label> | ||
</channel> | ||
|
||
<channel id="any_power_failures" typeId="power_failures"/> |
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.
The word "any" gives me the impression that it's a boolean value, but actually it's the count of power failures (long or short), if I understand it correctly. Perhaps the name could be rephrased to better express this? Perhaps power_failure_count
and long_power_failure_count
, respectively? Or simply power_failures
and long_power_failures
(which is already consistent with channel below)?
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, thanks, that is much better. When building up a model from the API, one tend to re-use those conventions.
@@ -98,6 +131,68 @@ | |||
|
|||
</thing-type> | |||
|
|||
<thing-type id="energy_socket"> |
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 thing type is already defined in line 78?
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.
Merge conflicts leftover. Fixed.
|
||
</thing-type> | ||
|
||
<thing-type id="watermeter"> |
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 thing type is already defined in line 109?
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.
Merge conflicts leftover. Fixed.
bundles/org.openhab.binding.homewizard/src/main/resources/OH-INF/update/instructions.xml
Show resolved
Hide resolved
Signed-off-by: Leo Siepel <leosiepel@gmail.com>
*/ | ||
public HomeWizardP1MeterHandler(Thing thing) { | ||
public HomeWizardP1MeterHandler(Thing thing, ZoneId zoneId) { |
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.
It would be better to store TimeZoneProvider
here in order to call timeZoneProvider.getTimeZone()
at the moment when creating ZonedDateTimes
. This way changes in time-zone will automatically have effect immediately.
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.
Yep, totally true.
bundles/org.openhab.binding.homewizard/src/main/resources/OH-INF/thing/thing-types.xml
Outdated
Show resolved
Hide resolved
Signed-off-by: Leo Siepel <leosiepel@gmail.com>
Signed-off-by: Leo Siepel <leosiepel@gmail.com>
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.
Last two comments, otherwise LGTM.
logger.warn("Unable to parse Gas timestamp: {}", e.getMessage()); | ||
gasTimestamp = null; | ||
} | ||
if (gasTimestamp != null) { |
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.
Just checking, it shouldn't be cleared (UNDEF
) otherwise?
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.
I would prefer to leave it as close to the original behaviour as possible.
Co-authored-by: Jacob Laursen <jacob-github@vindvejr.dk> Signed-off-by: lsiepel <leosiepel@gmail.com>
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
Signed-off-by: Leo Siepel <leosiepel@gmail.com>
Signed-off-by: Leo Siepel <leosiepel@gmail.com>
Resolves: #16988