-
-
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 #15550
[boschshc] Add scenario channel #15550
Conversation
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.
Beside the comments, thing upgrade instructions are also needed as a channel is added.
I have also edited to PR title, feel free to further adjust.
...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
bundles/org.openhab.binding.boschshc/src/main/resources/OH-INF/i18n/boschshc_de.properties
Outdated
Show resolved
Hide resolved
bundles/org.openhab.binding.boschshc/src/main/resources/OH-INF/thing/thing-types.xml
Outdated
Show resolved
Hide resolved
...hshc/src/test/java/org/openhab/binding/boschshc/internal/devices/bridge/LongPollingTest.java
Show resolved
Hide resolved
...c/src/main/java/org/openhab/binding/boschshc/internal/services/dto/BoschSHCServiceState.java
Show resolved
Hide resolved
bundles/org.openhab.binding.boschshc/src/main/resources/OH-INF/i18n/boschshc.properties
Outdated
Show resolved
Hide resolved
Signed-off-by: Patrick Gell <[email protected]>
@lsiepel During the documentation of the new channel I was wondering if the Bridge would be the right place for this channel. May I ask what would be your opinion on this option? Best regards, |
This pull request has been mentioned on openHAB Community. There might be relevant details there: |
Modeling the API-structure to the openHAB domain is something that you might want to discuss with the codeowner. I can understand your doubts to add it to the bridge, i can also understand that it is the best fit. As the channel does not seem to be specific for a room or device. (but that is just a quick look, i'm not a codeowner or maintainer) |
Signed-off-by: Patrick Gell <[email protected]>
Hi @pat-git023, thank you very much for this great enhancement, I recently thought that it would be nice to be able to get scenario notifications or even trigger scenarios 👍 Also thank you very much for your very quick review, @lsiepel 👍 The change as such looks good. But as already mentioned we should discuss whether the channel(s) should be added to the bridge directly, or rather added to scenarios that could be modeled as things. Adding the channel(s) directly to the bridge has the following disadvantages:
So from my current intuition I would propose to keep the bridge as stable as possible, and to model scenarios as a separate thing type. Scenarios could be identified via ID (does anyone know if we can create two scenarios with the same name, but different IDs?) and have the channels:
When modelling it this way the users do not have to re-create all their bridges and if the scenario features are extended, they would only have to re-create their scenarios. But I'm not 100% sure about this approach. I would like to hear what @GerdZanker and maybe also @jlaur think about it. By the way: do we need to create a github issue for this feature/enhancement? Already a big thank you to @pat-git023 for proposing this pull request 😎 |
This pull request has been mentioned on openHAB Community. There might be relevant details there: |
And why is that a disadvantage?
With the thing upgrade instructions since 4.0 that is no longer the case. |
@david-pace no problem. Was just solving a use-case of mine where I used the scenario trigger of the Bosch App to manipulate devices that are not in the Bosch system.. Thought that it might be also useful for others and give the changes back to the community. After thinking a bit further (executing a scenario from OH would also be nice) and having a look over the Bosch Rest API I had my doubts if the current solution would be the best one.
But how can a user react on a triggered scenario? For this use-case wouldn't it also make sense to have a separate channel that is updated with the current scenario name? Maybe a solution with both approaches is needed (like it is also in the Bosch API):
Btw: You can create multiple scenarios with the same name in the Bosch App and they get different IDs (looks like a Best regards, |
It would have been a major disadvantage if my assumption had been correct that the bridge has to be re-created by the users every time the channels are changed. But I was simply not aware of the thing upgrade instructions since 4.0, thanks for pointing that out. In this case both approaches are viable and as @pat-git023 pointed out, they can also be combined. There is also the approach to have a generic scenario trigger channel in the bridge (see list below). In general scenario names are more convenient for users (as opposed to scenario UUIDs), but if we use scenario names the special case with multiple scenarios with the same name can not be handled properly (it will we impossible to distinguish which scenario(s) were triggered if we get multiple events with the same scenario name). But probably it is a bad idea anyway to have multiple scenarios with the same name, so I guess it's ok if this is not supported; users should simply rename their scenarios in this case. Do you agree that user convenience is more important here than supporting this rather theoretical edge case? So as an overview, we have the following approaches:
From the user perspective:
My idea would be to go for the two bridge channels for now, and use names instead of UUIDs. This approach does not offer the full flexibility, but requires less configuration and has more pros than cons. And it is easier to implement. We can still add scenario things later if required. What do the others think? Any more pros/cons from your perspective? Would you prefer a "hybrid" approach the mixes bridge and thing channels or would you prefer to keep the channels at the same thing? Do you know if other openHAB bindings offer functionality redundantly (same mechanisms controllable via different channels/things)? Last question: is it reasonable to have two separate channels for listening to triggered scenarios and for actively triggering scenarios? Or could this even be combined in one channel? |
Hello @pat-git023, @david-pace prepared a good overview of the approaches and perspectives. I, as a user, like to trigger a scenario from openhab and I have already unique scenario names and want to use name in openhab.
I full agree to this and in general I also think step by step improvements are a good way! With every step we can learn and improve. |
Hi, Best regards, |
Hi @pat-git023, no problem, from my perspective the following points could be enhanced:
Once these two things are available, we will perform final code reviews and tests. |
Signed-off-by: Patrick Gell <[email protected]> Signed-off-by: Patrick Gell <[email protected]>
5ce68e8
to
c643d58
Compare
Hi, 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) ~[?:?]
My update instructions are: <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<update:update-descriptions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:update="https://openhab.org/schemas/update-description/v1.0.0"
xsi:schemaLocation="https://openhab.org/schemas/update-description/v1.0.0 https://openhab.org/schemas/update-description-1.0.0.xsd">
<thing-type uid="boschshc:shc">
<instruction-set targetVersion="1">
<add-channel id="triggered-scenario">
<type>boschshc:triggered-scenario</type>
</add-channel>
<add-channel id="execute-scenario">
<type>boschshc:execute-scenario</type>
</add-channel>
</instruction-set>
</thing-type>
</update:update-descriptions> Do you have any idea what I am doing wrong? Best regards, |
Did you also set the thingversion on the thing.xml itself?
|
Yes I did <bridge-type id="shc">
<label>Smart Home Controller</label>
<description>The Bosch Smart Home Bridge representing the Bosch Smart Home Controller.</description>
<channels>
<channel id="triggered-scenario" typeId="triggered-scenario"/>
<channel id="execute-scenario" typeId="execute-scenario"/>
</channels>
<properties>
<property name="thingTypeVersion">1</property>
</properties>
<config-description-ref uri="thing-type:boschshc:bridge"/>
</bridge-type> |
Signed-off-by: Patrick Gell <[email protected]>
Signed-off-by: Patrick Gell <[email protected]>
Hi, Best regards, |
Hi @pat-git023, thanks for the reminder. Is the issue with the thing update instructions solved in the mean time or do you still need support? And are all changes requested by @lsiepel implemented? If so, please remove the corresponding review state. Once both issues are solved I will test and review the code as soon as I find some time. |
@david-pace You have an idea how to solve that? |
Hi, I know that this happens quite often, but unfortunately I don't know the solution. Does someome know how to properly rebase and remove the reviewers again? |
Reviewers have to be removed manually as far as I know. As for resolving the rebase, I can only provide this link: and maybe also this as backup: #13570 (comment) |
@pat-git023 you could try one of the following strategies if you're using Eclipse: Strategy 1
Strategy 2
|
@david-pace Sorry for the inconvenience Best regards, |
[boschshc] Receive triggered scenarios of the Bosch Smart Home Controller
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.