Autoupdate="false" not working

Tags: #<Tag:0x00007f2fb518a8f8>

Hello, I got a few problems with the autoupdate=“false” function. The scripts are just for testing, exec-binding works great. The problem is, the switch that I want to be a button doesnt work. When its pressed, it changes his state to ON, wich the autoupdate function should prevent. What causes this? Any help is appreciated!
Sitemap:

 sitemap default label="Test" {
                    Frame label="LED Kitchen"{
                    Switch item=led1
    }}

Items:

Switch led1 "Scene1" ["Switchable"] {autoupdate="false", exec=">[ON:/etc/openhab2/scripts/mqtt.sh sceneOne]"}

Would you show us the events.log for this, please?

You seem to be using exec binding v.1, but I wouldn’t think that is involved here.

I cleared the events.log and restartet the service. I pressed the switch once, it stays ON

2019-09-04 13:36:31.629 [ItemChannelLinkAddedEvent ] - Link 'exec_command_ledon_input_run-exec:command:ledon:input:run' has been added.
2019-09-04 13:36:31.634 [ItemChannelLinkAddedEvent ] - Link 'exec_command_ledon_input-exec:command:ledon:input' has been added.
2019-09-04 13:37:03.473 [ItemCommandEvent          ] - Item 'led1' received command ON

When clicking again, its state changes to OFF

2019-09-04 13:36:31.629 [ItemChannelLinkAddedEvent ] - Link 'exec_command_ledon_input_run-exec:command:ledon:input:run' has been added.
2019-09-04 13:36:31.634 [ItemChannelLinkAddedEvent ] - Link 'exec_command_ledon_input-exec:command:ledon:input' has been added.
2019-09-04 13:37:03.473 [ItemCommandEvent          ] - Item 'led1' received command ON
2019-09-04 13:37:39.733 [ItemCommandEvent          ] - Item 'led1' received command OFF

Your log doesn’t show that your item state has been changed, but just that item have received the command. Which client you are using for sitemap? Autoupdate binding will auto update item state to match the command, so when autoupdate is disabled, command doesn’t change the state. And this what also can be seen from your log.

1 Like

openhab.log shows

2019-09-04 13:41:46.372 [WARN ] [ab.binding.exec.internal.ExecBinding] - doesn't find matching binding provider [itemName=led1, command=OFF]

for the missing OFF-command. This is correct I think

1 Like

Im jusing the BasicUI on my desktop

Switch in basicui doesn’t know anything about the autoupdate, so switch state will change the state in the ui when you click it. You can query your item state from karaf console after command sending to see the real state?

Sitemaps have also mappings functionality, where switch is button rather than on/off slider.

1 Like

As you may only need the ON command, please also set the Switch widget to use a mapping:

sitemap default label="Test" {
    Frame label="LED Kitchen"{
        Switch item=led1 mappings=[ON="ON"]
    }
}

Please be aware that you may have to restart openHAB before UI is properly updated after you pressed the button. Please also be aware that it might take some seconds for the button to reset.