-
-
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
[boschshc] Add scenario channel #15752
[boschshc] Add scenario channel #15752
Conversation
This PR is a followup of #15550 . There I had some issues with git and that's why I started with a fresh branch.
2023-09-21 21:01:32.001 [INFO ] [core.thing.internal.ThingManagerImpl] - Updating 'boschshc:shc:192-168-1-42' from version 0 to 1
2023-09-21 21:01:32.002 [ERROR] [core.thing.internal.ThingManagerImpl] - Checking/initializing thing 'boschshc:shc:192-168-1-42' failed unexpectedly.
java.lang.IllegalArgumentException: Provider for thing boschshc:shc:192-168-1-42 cannot be determined because it is not known to the registry
at org.openhab.core.thing.internal.ThingManagerImpl.thingUpdated(ThingManagerImpl.java:243) ~[?:?]
at org.openhab.core.thing.internal.ThingManagerImpl.checkAndPerformUpdate(ThingManagerImpl.java:1100) ~[?:?]
at org.openhab.core.thing.internal.ThingManagerImpl.registerAndInitializeHandler(ThingManagerImpl.java:917) ~[?:?]
at org.openhab.core.thing.internal.ThingManagerImpl.checkMissingPrerequisites(ThingManagerImpl.java:1122) ~[?:?]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539) ~[?:?]
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:305) ~[?:?]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305) ~[?:?]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) ~[?:?]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) ~[?:?]
at java.lang.Thread.run(Thread.java:833) ~[?:?]
Big thanks to @david-pace who investigated the issue and found the following problem (#15550 (comment)):
Best regards |
Thanks a lot for providing a new pull request, @pat-git023 👍 And nevermind the hassle with the rebase, it happens quite often. @J-N-K, do you have any idea what might cause the issue described in #15550 (comment) ? As mentioned I analyzed what happens in #15550 (comment). Thank you 🙂 |
Could the issue be related to the following warnings from the
|
@pat-git023 apparently we hit a bug that is fixed in the mean time. Could you please update your |
Signed-off-by: Patrick Gell <[email protected]>
cd078d9
to
9855ced
Compare
@david-pace |
Just a short update. With the latest 4.1.0-SNAPSHOT distribution from Jenknis I was able to successfully apply the update instructions to an existing Bosch Smart Home Bridge.
|
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 your contribution, and sorry for having been a victim of a bug in the channel type migration for so long. I have added a few comments, and will be confidently leaving the rest in the hands of the binding maintainers.
...schshc/src/main/java/org/openhab/binding/boschshc/internal/devices/bridge/BridgeHandler.java
Outdated
Show resolved
Hide resolved
...schshc/src/main/java/org/openhab/binding/boschshc/internal/devices/bridge/BridgeHandler.java
Outdated
Show resolved
Hide resolved
...schshc/src/main/java/org/openhab/binding/boschshc/internal/devices/bridge/BridgeHandler.java
Outdated
Show resolved
Hide resolved
...schshc/src/main/java/org/openhab/binding/boschshc/internal/devices/bridge/BridgeHandler.java
Outdated
Show resolved
Hide resolved
...schshc/src/main/java/org/openhab/binding/boschshc/internal/devices/bridge/BridgeHandler.java
Outdated
Show resolved
Hide resolved
...hshc/src/main/java/org/openhab/binding/boschshc/internal/devices/bridge/ScenarioHandler.java
Outdated
Show resolved
Hide resolved
...hshc/src/main/java/org/openhab/binding/boschshc/internal/devices/bridge/ScenarioHandler.java
Outdated
Show resolved
Hide resolved
bundles/org.openhab.binding.boschshc/src/main/resources/OH-INF/i18n/boschshc.properties
Outdated
Show resolved
Hide resolved
...schshc/src/main/java/org/openhab/binding/boschshc/internal/devices/bridge/BridgeHandler.java
Outdated
Show resolved
Hide resolved
...hc/src/main/java/org/openhab/binding/boschshc/internal/devices/BoschSHCBindingConstants.java
Outdated
Show resolved
Hide resolved
...hc/src/main/java/org/openhab/binding/boschshc/internal/devices/BoschSHCBindingConstants.java
Outdated
Show resolved
Hide resolved
...hshc/src/main/java/org/openhab/binding/boschshc/internal/devices/bridge/ScenarioHandler.java
Outdated
Show resolved
Hide resolved
...hshc/src/main/java/org/openhab/binding/boschshc/internal/devices/bridge/ScenarioHandler.java
Outdated
Show resolved
Hide resolved
...hshc/src/main/java/org/openhab/binding/boschshc/internal/devices/bridge/ScenarioHandler.java
Outdated
Show resolved
Hide resolved
...hshc/src/main/java/org/openhab/binding/boschshc/internal/devices/bridge/ScenarioHandler.java
Show resolved
Hide resolved
...n/java/org/openhab/binding/boschshc/internal/serialization/BoschServiceDataDeserializer.java
Show resolved
Hide resolved
bundles/org.openhab.binding.boschshc/src/main/resources/OH-INF/i18n/boschshc.properties
Outdated
Show resolved
Hide resolved
.../src/test/java/org/openhab/binding/boschshc/internal/devices/bridge/ScenarioHandlerTest.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Patrick Gell <[email protected]>
...hshc/src/main/java/org/openhab/binding/boschshc/internal/devices/bridge/ScenarioHandler.java
Show resolved
Hide resolved
...hshc/src/main/java/org/openhab/binding/boschshc/internal/devices/bridge/ScenarioHandler.java
Show resolved
Hide resolved
...va/org/openhab/binding/boschshc/internal/serialization/BoschServiceDataDeserializerTest.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Patrick Gell <[email protected]>
Signed-off-by: Patrick Gell <[email protected]>
Hello @pat-git023, I found the time to compile your code and test it: Receiving triggered Scenarios and triggering Scenarios by Name works well - good job! I really want to get your feature in a new update, because it enables many more smart home integration scenarios. BTW: It took me some minutes more for testing, because one of my created scenario names contained a space at the end of its names, leading to a mismatch when triggering it and I never detected this before. Because I joined this PR late, I will leave the code review to @jlaur and @david-pace. |
Good news 🙂
@jlaur I also marked your review comments as resolved after verifying that your suggestions were implemented. But of course you can check again just to be sure, sometimes two pairs of eyes see more 😉 There are some strange things I noticed while testing but I think it is not related to this pull request: when starting openHAB, the bridge was in state Also, I see many exceptions like this in the log:
But the Bosch SHC things are all online and working fine. @GerdZanker @pat-git023 @jlaur have you noticed any of behavior and do you think it has to do something with this pull request? Does anyone know who triggers/queues these REST requests? |
This can happen during thing update if a channel is missing (because it's not yet removed) - see #15774 (comment) I don't know why you have experienced it for this PR though, since it only adds two new channels. Could it have been caused by switching back and forth between versions while testing? If your thing would already be upgraded with the new channels, and you would then go back to the previous version, this would probably happen. |
OK, then I know why this happened: throughout the development of this PR I checked out the code multiple times, and the channel names changed a few times as well. But the thing type version always stayed the same. So I guess this puzzle is solved, thanks 👍 Do you have any idea why I get these REST-related exceptions? |
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.
Very minor last findings, otherwise LGTM.
...schshc/src/main/java/org/openhab/binding/boschshc/internal/devices/bridge/BridgeHandler.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Patrick Gell <[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.
LGTM
Unfortunately I don't. Did anyone else experience it? And you don't see it when running without the changes from this PR? I'll hold back the merge for a while until you have had a chance to comment/test. @pat-git023 - I assume you didn't experience this exception? |
Hi,
Test steps:
|
@GerdZanker Thanks a lot for the feedback. And also @david-pace and @jlaur for your great support!!! For you naming miss match with the trailing white space would you suggest to handle this case in the scenario filtering (execute a Scenario 'Scenario 1' was not found in the list of available scenarios [
Scenario{name='Scenario 1 ', id='d47dc88c-8153-4320-ba1d-d1e9540f3951', lastTimeTriggered='1699373054871'}
Scenario{name='Scenario 2', id='c473d8d0-db25-4ea7-879f-0d0641a658c7', lastTimeTriggered='1699373054871'}] |
I like your logging idea, because it helps in case of other mistakes too, e.g. when names are not matching at all. |
I can add the additional log but only on the weekend. I am currently
traveling and don’t have access to my dev machine.
Best regards
Patrick
Gerd Zanker ***@***.***> schrieb am Di. 7. Nov. 2023 um 20:15:
… ***@***.**** approved this pull request.
—
Reply to this email directly, view it on GitHub
<#15752 (review)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ANCR42D4AN5WUFLMFR2XWO3YDKCDPAVCNFSM6AAAAAA6AHOVN6VHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMYTOMJYGUZTCOBSGI>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Meanwhile I tested again and could not reproduce the REST exceptions anymore. Probably a random hiccup not related to this PR. @jlaur should we wait for the logging enhancement or should we create a new PR for that? |
👍 Excellent! So I'd say the PR is ready for being merged.
I would leave that decision to @pat-git023. If the logging is to pinpoint as suspected problem within this PR (trailing space in a scene name?), it might be worth getting it in to potentially avoid a follow-up bugfix. If it will be logging only without any specific suspicion, that could also be added in another PR. I'm fine to merge as is, but on the other hand, I guess there is no rush, so if @pat-git023 would like to include the logging here, we can wait until the weekend. Let me know how you'd prefer to proceed. |
ok, let's wait until the weekend, then we can properly celebrate the merge 😉🎉🍻 |
Signed-off-by: Patrick Gell <[email protected]>
Thank you very much for the valuable contribution @pat-git023 👍 And big thanks to @jlaur for the insightful reviews and help during this PR ❤️ |
🎉 Thank you all for your great support ❤️ |
Signed-off-by: Patrick Gell <[email protected]>
Signed-off-by: Patrick Gell <[email protected]> Signed-off-by: Jørgen Austvik <[email protected]>
Add Support to receives and trigger scenarios on Bosch SHC
Description
Some devices (e.g. Universal Switch Flex) of the Bosch Smart Home Controller trigger a preconfigured scenario on the SHC. Do be able to react on such a trigger this PR enhances the current bridge implementation with a channel that get's updated with the name of the triggered scenario.