-
Notifications
You must be signed in to change notification settings - Fork 336
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
MultiLevelSensor gets confused with multiple LevelProperties with different units #1148
Comments
Yeah, I've actually been trying to figure out what to do in cases like this. The same problem occurs on a smart plug with 2 outlets. A workable solution is to only set one of them as a |
Best case scenario the user can choose what property is displayed as primary value. I'm thinking of the weather station here, where some may want to quickly see the temperature, while other may want to see CO2 concentration or humidity etc. |
As the capability system matures, we should start to gain things like I want to keep this issue open, though, for cases where there will continue to be 2 of the exact same property type. |
Hmm, I didn't think of that. For the time being can we get the UI to just pick one of the I agree in this use case it would be nice if the user could choose, but in the meantime we should at least not switch between different properties and display the wrong unit. It would definitely be preferable that you don't have to leave off semantic annotations just to tell our UI which value to show. |
@benfrancis The problem with picking the "first one" is that it's a JSON object, so "first" is indeterminate. We could try to sort the property names, but that is not necessarily what the developer intended either. What @dhylands and I decided to do in the case of the dual-outlet smart plug was to set one to the |
The same thing also occurs when you have a smart plug with a light on it. It will need to have an |
Unsure if related but I have observed UI issues when a thing contains 2 properties of same types (ie onoff switch) |
Yes, that's the exact same issue. |
I spent some time to figure out the problem, but I am not sure I got it yet (maybe using the same node ID in widget's template) but I can share a sample code to reproduce the issue, I'll ping you on IRC. I've a possible workaround to share. |
Previously item ids were duplicated, the observed consequence is that any click on widgets is seen as click on 1st declared element. For example, a thing with 2 switches is displayed correctly, and click events are also triggered but will be "redirected" to 1st switch only, this is not desired. Change-Id: I27ef75a95889c37224aa7da6b0fbf8e2ad57ba65 Bug: WebThingsIO#1148 Signed-off-by: Philippe Coval <p.coval@samsung.com>
Feedback welcome I only made the fix for switch prop then this can be replicated to other components if solution is acceptable. ps: Gz for @mrstegeman .fork() ! |
Previously item ids were duplicated, the observed consequence is that any click on widgets is seen as click on 1st declared element. For example, a thing with 2 switches is displayed correctly, and click events are also triggered but will be "redirected" to 1st switch only, this is not desired. Change-Id: I27ef75a95889c37224aa7da6b0fbf8e2ad57ba65 Bug: WebThingsIO#1148 Origin: https://github.com/tizenteam/gateway Signed-off-by: Philippe Coval <p.coval@samsung.com>
Previously item ids were duplicated, the observed consequence is that any click on widgets is seen as click on 1st declared element. For example, a thing with 2 switches is displayed correctly, and click events are also triggered but event will be "redirected" to 1st switch only, this is not desired. This change fix it for boolean related widget, and once solution merged, it can be easly replicated to others WoT types (level, text etc). Change-Id: I27ef75a95889c37224aa7da6b0fbf8e2ad57ba65 Bug: WebThingsIO#1148 Forwarded: WebThingsIO#1249 Origin: https://github.com/tizenteam/gateway Signed-off-by: Philippe Coval <p.coval@samsung.com>
Previously item ids were duplicated, the observed consequence is that any click on widgets is seen as click on 1st declared element. For example, a thing with 2 switches is displayed correctly, and click events are also triggered but event will be "redirected" to 1st switch only, this is not desired. This change fix it for boolean related widget, and once solution merged, it can be easly replicated to others WoT types (level, text etc). Change-Id: I27ef75a95889c37224aa7da6b0fbf8e2ad57ba65 Bug: WebThingsIO#1148 Forwarded: WebThingsIO#1249 Origin: https://github.com/tizenteam/gateway Signed-off-by: Philippe Coval <p.coval@samsung.com>
Previously item ids were duplicated, the observed consequence is that any click on widgets is seen as click on 1st declared element. For example, a thing with 2 switches is displayed correctly, and click events are also triggered but event will be "redirected" to 1st switch only, this is not desired. This change fix it for boolean related widget, and once solution merged, it can be easly replicated to others WoT types (level, text etc). Change-Id: I27ef75a95889c37224aa7da6b0fbf8e2ad57ba65 Bug: WebThingsIO#1148 Forwarded: WebThingsIO#1249 Origin: https://github.com/tizenteam/gateway Signed-off-by: Philippe Coval <p.coval@samsung.com>
Previously item ids were duplicated, the observed consequence is that any click on widgets is seen as click on 1st declared element. For example, a thing with 2 switches is displayed correctly, and click events are also triggered but event will be "redirected" to 1st switch only, this is not desired. It was tested for boolean, number related components. Change-Id: I27ef75a95889c37224aa7da6b0fbf8e2ad57ba65 Bug: WebThingsIO#1148 Forwarded: WebThingsIO#1249 Origin: https://github.com/tizenteam/gateway Signed-off-by: Philippe Coval <p.coval@samsung.com>
Previously UI item's ids were duplicated, the observed consequence is that any click on widgets is catched by 1st declared element. For example, a thing with 2 switches is displayed correctly, and click events are also triggered but event will be "redirected" to 1st switch only, this is not desired. It was tested for boolean, number related components. Change-Id: I27ef75a95889c37224aa7da6b0fbf8e2ad57ba65 Bug: WebThingsIO#1148 Forwarded: WebThingsIO#1249 Origin: https://github.com/tizenteam/gateway Signed-off-by: Philippe Coval <p.coval@samsung.com>
Previously UI item's ids were duplicated, the observed consequence is that any click on widgets is catched by 1st declared element. For example, a thing with 2 switches is displayed correctly, and click events are also triggered but event will be "redirected" to 1st switch only, this is not desired. It was tested for boolean, number related components. Slider not fully updated, to keep passing tests, more refactoring to come in that part (grep '#slide') Change-Id: I27ef75a95889c37224aa7da6b0fbf8e2ad57ba65 Bug: WebThingsIO#1148 Forwarded: WebThingsIO#1249 Origin: https://github.com/tizenteam/gateway Signed-off-by: Philippe Coval <p.coval@samsung.com>
Previously UI item's ids were duplicated, the observed consequence is that any click on widgets is catched by 1st declared element. For example, a thing with 2 switches is displayed correctly, and click events are also triggered but event will be "redirected" to 1st switch only, this is not desired. It was tested for boolean, number related components. Slider not fully updated, to keep passing tests, more refactoring to come in that part (grep '#slider') Change-Id: I27ef75a95889c37224aa7da6b0fbf8e2ad57ba65 Bug: WebThingsIO#1148 Forwarded: WebThingsIO#1249 Origin: https://github.com/tizenteam/gateway Signed-off-by: Philippe Coval <p.coval@samsung.com>
Previously UI item's ids were duplicated, the observed consequence is that any click on widgets is catched by 1st declared element. For example, a thing with 2 switches is displayed correctly, and click events are also triggered but event will be "redirected" to 1st switch only, this is not desired. It was tested for boolean, number related components. Slider not fully updated, to keep passing tests, more refactoring to come in that part (grep '#slider') Change-Id: I27ef75a95889c37224aa7da6b0fbf8e2ad57ba65 Bug: WebThingsIO#1148 Forwarded: WebThingsIO#1249 Origin: https://github.com/tizenteam/gateway Signed-off-by: Philippe Coval <p.coval@samsung.com>
To avoid clash LevelProperty's id are renamed to slide-level-${count} It was tested on ARTIK05x thing (2 switches, 2 booleans, 2 levels) Change-Id: If530737168af14eb8f6f1e9e230e04a432490045 Bug: WebThingsIO#1148 Forwarded: WebThingsIO#1249 Origin: https://github.com/tizenteam/gateway Signed-off-by: Philippe Coval <p.coval@samsung.com>
Can you please try linked patches from: It worked for me on this "in progress" thing: |
Previously UI item's ids were duplicated, the observed consequence is that any click on widgets is catched by 1st declared element. For example, a thing with 2 switches is displayed correctly, and click events are also triggered but event will be "redirected" to 1st switch only, this is not desired. It was tested for boolean, number related components. Slider not fully updated, to keep passing tests, more refactoring to come in that part (grep '#slider') Change-Id: I27ef75a95889c37224aa7da6b0fbf8e2ad57ba65 Bug: WebThingsIO#1148 Forwarded: WebThingsIO#1249 Origin: https://github.com/tizenteam/gateway Signed-off-by: Philippe Coval <p.coval@samsung.com>
To avoid clash LevelProperty's id are renamed to slide-level-${count} It was tested on ARTIK05x thing (2 switches, 2 booleans, 2 levels) Change-Id: If530737168af14eb8f6f1e9e230e04a432490045 Bug: WebThingsIO#1148 Forwarded: WebThingsIO#1249 Origin: https://github.com/tizenteam/gateway Signed-off-by: Philippe Coval <p.coval@samsung.com>
I confirm this UI issue is affecting latest release, I can share a code for ARTIK or RPi to reproduce and verify pending change at: |
I think you found an adjacent issue, what I was initially referencing is the state the gateway chooses for the central thing blob for BinarySensors or MultiLevelSensors, not necessarily the actual individual properties not working individually, which is the even bigger issue, I guess. |
Previously UI item's ids were duplicated, the observed consequence is that any click on widgets is catched by 1st declared element. For example, a thing with 2 switches is displayed correctly, and click events are also triggered but event will be "redirected" to 1st switch only, this is not desired. It was tested for boolean, number related components. Slider not fully updated, to keep passing tests, more refactoring to come in that part (grep '#slider') Change-Id: I27ef75a95889c37224aa7da6b0fbf8e2ad57ba65 Bug: WebThingsIO#1148 Forwarded: WebThingsIO#1249 Origin: https://github.com/tizenteam/gateway Signed-off-by: Philippe Coval <p.coval@samsung.com>
@mrstegeman said { Yes, that's the exact same issue. } May I ask you @freaktechnik to test my patch and report if it does not make situation worse ;) |
I think it fixes it even, but it's hard to reproduce for me, without going through the paces and building a custom virtual thing that happens to trigger this. I had encountered this randomly in the wild... |
Previously UI item's ids were duplicated, the observed consequence is that any click on widgets is catched by 1st declared element. For example, a thing with 2 switches is displayed correctly, and click events are also triggered but event will be "redirected" to 1st switch only, this is not desired. It was tested for boolean, number related components. Slider not fully updated, to keep passing tests, more refactoring to come in that part (grep '#slider') Change-Id: I27ef75a95889c37224aa7da6b0fbf8e2ad57ba65 Bug: WebThingsIO#1148 Forwarded: WebThingsIO#1249 Origin: https://github.com/tizenteam/gateway Signed-off-by: Philippe Coval <p.coval@samsung.com>
Previously UI item's ids were duplicated, the observed consequence is that any click on widgets is catched by 1st declared element. For example, a thing with 2 switches is displayed correctly, and click events are also triggered but event will be "redirected" to 1st switch only, this is not desired. The change is only fixing boolean widgets, others to come later. Note: It was suggested to use nested inputs, but unfortunately CSS can't traverse (to input) and get back to parent (label), so "for" facility and id must be used. Change-Id: I27ef75a95889c37224aa7da6b0fbf8e2ad57ba65 Bug: WebThingsIO#1148 Forwarded: WebThingsIO#1249 Origin: https://github.com/tizenteam/gateway Signed-off-by: Philippe Coval <p.coval@samsung.com>
Previously UI item's ids were duplicated, the observed consequence is that any click on widgets is catched by 1st declared element. For example, a thing with 2 switches is displayed correctly, and click events are also triggered but event will be "redirected" to 1st switch only, this is not desired. The change is only fixing boolean widgets, others to come later. Note: It was suggested to use nested inputs, but unfortunately CSS can't traverse (to input) and get back to parent (label), so "for" facility and id must be used. Change-Id: I27ef75a95889c37224aa7da6b0fbf8e2ad57ba65 Bug: WebThingsIO#1148 Forwarded: WebThingsIO#1249 Origin: https://github.com/tizenteam/gateway Signed-off-by: Philippe Coval <p.coval@samsung.com>
* ui: Fix boolean and switch widgets (if multiple) Previously UI item's ids were duplicated, the observed consequence is that any click on widgets is catched by 1st declared element. For example, a thing with 2 switches is displayed correctly, and click events are also triggered but event will be "redirected" to 1st switch only, this is not desired. The change is only fixing boolean widgets, others to come later. Note: It was suggested to use nested inputs, but unfortunately CSS can't traverse (to input) and get back to parent (label), so "for" facility and id must be used. Change-Id: I27ef75a95889c37224aa7da6b0fbf8e2ad57ba65 Bug: #1148 Forwarded: #1249 Origin: https://github.com/tizenteam/gateway Signed-off-by: Philippe Coval <p.coval@samsung.com> * Update switch.js
In case of multiple property of same types, UI events were forwarded to 1st instance of widget. This change is a follow up of the switch change: Bug: WebThingsIO#1148 Relate-to: WebThingsIO#1249 Change-Id: I2018092168af14eb8f6f1e9e230e04a432490045 Signed-off-by: Philippe Coval <p.coval@samsung.com>
In case of multiple property of same types, UI events were forwarded to 1st instance of widget. This change is a follow up of the switch change: Origin: WebThingsIO#1370 Bug: WebThingsIO#1148 Relate-to: WebThingsIO#1249 Change-Id: I2018092168af14eb8f6f1e9e230e04a432490045 Signed-off-by: Philippe Coval <p.coval@samsung.com>
* ui: Select by class instead of (multiple) id In case of multiple property of same types, UI events were forwarded to 1st instance of widget. This change is a follow up of the switch change: Origin: #1370 Bug: #1148 Relate-to: #1249 Change-Id: I2018092168af14eb8f6f1e9e230e04a432490045 Signed-off-by: Philippe Coval <p.coval@samsung.com> * ui: Prevent duplicated id This change has no real effect, only for making code more uniform, Note that slider id has been renamed to slider-level to remove ambiguity with slider, and counter suffix adjusted. Forwarded: #1370 Change-Id: I64fe6a78a8ae9d300bab58561a7b0eec7bfb09db Signed-off-by: Philippe Coval <p.coval@samsung.com>
If a
MultiLevelSensor
thing has multipleLevelProperty
properties, it adapts the last updated value as its current main value. It does however not adapt the unit of the updated property, so the center of the thing will contain a number with the wrong unit.The text was updated successfully, but these errors were encountered: