Skip to content
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

Switch item cannot be toggled in sitemap #3870

Open
dilyanpalauzov opened this issue Mar 3, 2025 · 6 comments
Open

Switch item cannot be toggled in sitemap #3870

dilyanpalauzov opened this issue Mar 3, 2025 · 6 comments
Labels
bug Indicates an unexpected problem or unintended behavior

Comments

@dilyanpalauzov
Copy link
Contributor

For an item of type Switch in the sitemap I define

Switch item=r9 visibility=[r9_manual==ON] staticIcon="poweroutlet"
Text item=r9 visibility=[r9_manual==OFF] valuecolor=[ON="green", OFF="red"] staticIcon="poweroutlet"
Switch item=r9_manual mappings=[ON="Manual", OFF="Automatic"] labelcolor=[OFF="green", ON="red"] visibility=[!=NULL]

When I toggle over BasicUI the value of r9_manual, the interface is updated in both BasicOH and OH-Android (the first switch item is hidden, the text item is shown, or vice versa). So r9_manual is not NULL. But in Android-OH 3.17.4-beta neither the "Manual" nor the "Automatic" values is selected, the values are shown, but cannot be pressed. The labelcolor is correct.

@dilyanpalauzov dilyanpalauzov added the bug Indicates an unexpected problem or unintended behavior label Mar 3, 2025
@mueller-ma
Copy link
Member

This might be caused by #3856. Can you post the Item definition of r9 and r9_manual?

@dilyanpalauzov
Copy link
Contributor Author

The item definitions are:

Switch r9_manual "Control[]" <none> (gRele9) ["Switch"] {channel="mqtt:topic:r9:r9_manual"}
Switch r9        "9 Relay [MAP(switch.map):%s]" <poweroutlet> (gRele9) ["Switch"] {channel="mqtt:topic:r9:r9"}

Thing definitions (actually channel definitions within an MQTT thing):

Type switch  : r9        "Relay 9" [stateTopic="r9/status/switch:0", transformationPattern="JSONPATH:$.output", off="false", on="true", transformationPatternOut="MAP:abc.map", commandTopic="r9/rpc", postCommand="true" ]
Type switch  : r9_manual "Relay 9" [stateTopic="r9V/rpc", transformationPattern="JSONPATH:$.result.initial_state", off="off", on="restore_last"]

@mueller-ma
Copy link
Member

And can you post the content of https://your server/rest/items/r9 and r9_manual?

@dilyanpalauzov
Copy link
Contributor Author

{"link":"https://server/rest/items/r9","state":"ON", "transformedState":"Включено",
"stateDescription":{"pattern":"MAP(switch.map):%s","readOnly":false,"options":[]},
"metadata":{"semantics":{"value":"Point_Control_Switch","config":{"isPointOf":"gRele9"}}},
"editable":false,"type":"Switch","name":"r9",
"label":"9 Реле","category":"poweroutlet","tags":["Switch"],"groupNames":["gRele9"]}
{"link":"https://server/rest/items/r9_manual","state":"ON",
"stateDescription":{"pattern":"","readOnly":true,"options":[]},
"metadata":{"semantics":{"value":"Point_Control_Switch","config":{"isPointOf":"gRele9"}}},
"editable":false,"type":"Switch","name":"r9_manual",
"label":"Управление","category":"none","tags":["Switch"],"groupNames":["gRele9"]}

I use OpenHAB 4.2.2. The problem is only with the r9_manual Switch. The other sitemap-lines, bound to r9 are shown correctly - either the one, or the other.

Where does "readOnly":true come from?

@mueller-ma
Copy link
Member

Where does "readOnly":true come from?

That question is better asked here: https://github.com/openhab/openhab-addons/ That might be a bug that needs to be resolved there.
Maybe the change in the client should be reverted until this issue is fixed.

@dilyanpalauzov
Copy link
Contributor Author

I filled openhab/openhab-addons#18362. In the meantime I add dummy commandTopic="abc" in the MQTT-channel, then the item is read-write.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Indicates an unexpected problem or unintended behavior
Projects
None yet
Development

No branches or pull requests

2 participants