Hi,
I have a very simple scenario:
When the window is open (contact sensor), then the slider of the roller shutter should be disabled (why? well it will unroll over the window and “kill it”)
I was looking for a rule to update some metadata of items:
For any item you can define custom widgets that will be displayed as the default widget in auto-generated OH lists. This value is set in the item metadata under Default List Item Widget. In this case there is a very simple solution and you don’t even really need to create your own widget. You can use nearly all the default settings that are in place in that metadata. However, if you scroll down to the bottom of that page, there is a Visible field that takes a widget expression. The expression just needs to return a boolean result with true meaning the item will be visible and false meaning it will not. So in this case you want an expression based on the state of your window contact. Something like this:
@JustinG is there a way to simply “disable” (make it read only) ? As a workaround I could define another item “Text” that display the value when the slider is disabled but well it’s a workaround
Yes there is, just not through the UI fields on the metadata page. You’ll have to go back to that metadata page and then switch over to the the code tab. There you’ll see the yaml for the visible property you configured. But instead of visible you want to use disabled. So replace ‘visible’ with ‘disabled’ manually. Then you’ll need to switch around your expression because for this property, true is the disabled state and false is the enabled state. In this case just changing == to != should be sufficient.