It make sense that it’s read only in this application. However, I would like to test out some rules based on this item. So without the ability to manually setting it, it would be difficult to test rules.
The only way it seems is to use API. As it shown on the second picture, I was able to manually set the state to ON via API.
Is there a way to manually disable this ready only and bring the toggle back temporarily?
Hmm. Maybe try turning out on, then back off to force it? What’s the YAML code for that Item’s metadata? Turning it on then back off should force readOnly: false in the YAML.
What’s going on is the Binding gives hints that this Switch Item is read only. There is no way to override that default in MainUI. But there are several options you can use:
Use the REST API, which you’ve already mentioned.
Use the Karaf Console
Use the --Scratchpad-- Script. From the Developer Sidebar (ALT-SHIFT-D or from the Developer Tools menu) bring up the third tab and click on “Open Scripting Scratchpad”. If it doesn’t already exist that will open a new Script called “–Scratchpad–” where you can enter and execute some Rules code. I find this particularly helpful when testing, especially complicated tests where more than one Item is involved.
On the Item, define a new “default cell widget” and set an action to toggle the state of the Item when it’s clicked. Then in the Developer Sidebar go to the first column and search for your Item and pin it. When you click on the Item from there it will show the default card widget which will let you toggle the Item. (I’ve had this sometimes not work).
On the Item, define a new “default stand alone widget” and select a toggle widget (or set an Action to toggle the Item on a label widget) and you can interact with the Item at the top of the Item’s page.
I mainly list these as knowing all the ways you can interact with Items while testing can be very useful in different circumstances.
The binding is saying it’s read only so that becomes the default for that Item. You need to override that default. It might be worth filing a bug report as you shouldn’t have to toggle it to get the metadata to override the default. Just setting the metadata to what you want should be sufficient.