-
-
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
[netatmo] Null annotations Part 3 of 3 #8057
Conversation
Fix openhab#7913 Signed-off-by: Laurent Garnier <lg.hc@free.fr>
I tagged this PR with "Work in progress" due to the number of changes and the usage of Optional I am not expert in. This requires a good testing before a merge. |
Travis tests were successfulHey @lolodomo, |
After a quick test, everything looks good. I am confident in my changes. But I will do more tests to be very sure. |
Tag "Work in progress" removed, I found only little bug that I immediately fixed and which was already present before this PR, the video status from the last event must be computed only if the event contains a video. |
Signed-off-by: Laurent Garnier <lg.hc@free.fr>
Travis tests were successfulHey @lolodomo, |
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
Travis tests were successfulHey @lolodomo, |
Fix openhab#8083 Signed-off-by: Laurent Garnier <lg.hc@free.fr>
Travis tests were successfulHey @lolodomo, |
@clinique : please review my last change, I implemented the configuration option for the background discovery. Works perfectly as expected. |
- Some features like the video surveillance are accessed via the local network, so it may be helpful to set a static IP address | ||
for the camera within your local network. | ||
|
||
- The URL of the live snapshot is a fixed URL so the value of the channel cameraLivePictureUrl / welcomeCameraLivePictureUrl will never be updated once first set by the binding. So to get a refreshed picture, you need to use the refresh parameter in your sitemap image element. |
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.
Please put each sentence on its own line.
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 was done to avoid a warning in the checks (blank line required after a list item, something like that).
Either 2 lines to help maintenance but a warning, or one line and no warning.
Let me know what you prefer.
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 leave as is then. I've prefer to avoid the warning even if it might be misguided.
NetatmoBridgeHandler handler = getBridgeHandler(); | ||
if (handler == null) { | ||
if (!getBridgeHandler().isPresent() || device == 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.
Caching the bridge handler result in a local variable is much safer from a concurrency standpoint.
if (bridgeHandler != null && avatarURL == null && module != null) { | ||
NAWelcomeFace face = module.getFace(); | ||
private @Nullable String getAvatarURL() { | ||
if (getBridgeHandler().isPresent() && avatarURL == null && getModule().isPresent()) { |
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.
getBridgeHandler() and getModule() should be cached to local variables
if (getBridgeHandler().isPresent() && getLastEvent().isPresent() | ||
&& getLastEvent().get().getSnapshot() != 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.
getBridgeHandler() and getLastEvent() should be cached to local variables
return (getLastEvent().isPresent() && getLastEvent().get().getMessage() != null) | ||
? toStringType(getLastEvent().get().getMessage().replace("<b>", "").replace("</b>", "")) |
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 get the idea, fix wherever else it might apply.
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.
Understood
Signed-off-by: Laurent Garnier <lg.hc@free.fr>
Travis tests were successfulHey @lolodomo, |
Review comments taken into account. |
Thank you for the quick review and merge. |
* [netatmo] Null annotations Part 3 of 3 Fix openhab#7913 * Video status only set when there is a video in the event * Add a setting to enable/disable the background discovery Fix openhab#8083 * Cache Optional result in local variable Signed-off-by: Laurent Garnier <lg.hc@free.fr>
* [netatmo] Null annotations Part 3 of 3 Fix openhab#7913 * Video status only set when there is a video in the event * Add a setting to enable/disable the background discovery Fix openhab#8083 * Cache Optional result in local variable Signed-off-by: Laurent Garnier <lg.hc@free.fr> Signed-off-by: CSchlipp <christian@schlipp.de>
* [netatmo] Null annotations Part 3 of 3 Fix openhab#7913 * Video status only set when there is a video in the event * Add a setting to enable/disable the background discovery Fix openhab#8083 * Cache Optional result in local variable Signed-off-by: Laurent Garnier <lg.hc@free.fr> Signed-off-by: MPH80 <michael@hazelden.me>
* [netatmo] Null annotations Part 3 of 3 Fix openhab#7913 * Video status only set when there is a video in the event * Add a setting to enable/disable the background discovery Fix openhab#8083 * Cache Optional result in local variable Signed-off-by: Laurent Garnier <lg.hc@free.fr>
* [netatmo] Null annotations Part 3 of 3 Fix openhab#7913 * Video status only set when there is a video in the event * Add a setting to enable/disable the background discovery Fix openhab#8083 * Cache Optional result in local variable Signed-off-by: Laurent Garnier <lg.hc@free.fr>
* [netatmo] Null annotations Part 3 of 3 Fix openhab#7913 * Video status only set when there is a video in the event * Add a setting to enable/disable the background discovery Fix openhab#8083 * Cache Optional result in local variable Signed-off-by: Laurent Garnier <lg.hc@free.fr>
* [netatmo] Null annotations Part 3 of 3 Fix openhab#7913 * Video status only set when there is a video in the event * Add a setting to enable/disable the background discovery Fix openhab#8083 * Cache Optional result in local variable Signed-off-by: Laurent Garnier <lg.hc@free.fr>
* [netatmo] Null annotations Part 3 of 3 Fix openhab#7913 * Video status only set when there is a video in the event * Add a setting to enable/disable the background discovery Fix openhab#8083 * Cache Optional result in local variable Signed-off-by: Laurent Garnier <lg.hc@free.fr> Signed-off-by: Daan Meijer <daan@studioseptember.nl>
* [netatmo] Null annotations Part 3 of 3 Fix openhab#7913 * Video status only set when there is a video in the event * Add a setting to enable/disable the background discovery Fix openhab#8083 * Cache Optional result in local variable Signed-off-by: Laurent Garnier <lg.hc@free.fr>
Fix #7913
Signed-off-by: Laurent Garnier lg.hc@free.fr