Controlling a switch with a script

Hello!
I have a bug, when I controlling a switch via a script. The script change the value of the switch.
The switch widget value change but the switch didn’t send its OSC message.

set('preset_recall_switch_0', 1);

According to the documentation, it’'s should send the OCS message, isn’t it ?

Thanks.

It does if the switch has a target or if a default target is defined using the server’s send option (assuming the switch’s bypass/ignoreDefaults options are not enabled).

Ok! So I think I have a bug. You can find a minimal session of this mechanism in attachement :
empty_session - minimal.json (21.7 KB)

  • Mechanism of the script
    • When a shortcut is press :

      • Hight light label description
      • Change switch value
    • Behavior :

      • When my shortcut is set by default the switch send correctly the message.
      • When I modify the default value of my shortcut key, the switch state change correctly but it don’t send OSC message.

Do you think it’s coming from my code ?

When I modify the default value of my shortcut key,

You mean when you change the key by entering a different letter in the input ? When I do so, the new key is correctly bound and a message is sent by the switch when I press it.

Yes.
I test on the release v1.7.7 and v1.8.0, and it dont work… The bounding work but no message is send.
Here my debug log :

(DEBUG, OSC) Out:  { address: '/preset/recall', args: [ { type: 'i', value: 1 } ] } To: 127.0.0.1:7775
(DEBUG, OSC) In:  { address: '/preset/recall', args: 1 } From: 127.0.0.1:7775
(DEBUG, OSC) Out:  { address: '/preset/recall', args: [ { type: 'i', value: 2 } ] } To: 127.0.0.1:7775
(DEBUG, OSC) In:  { address: '/preset/recall', args: 2 } From: 127.0.0.1:7775
(DEBUG, OSC) Out:  {
  address: '/keys',
  args: [ { type: 'f', value: 1 }, { type: 's', value: 'b' } ]
} To: 127.0.0.1:7775
(DEBUG, OSC) In:  { address: '/keys', args: [ 1, 'b' ] } From: 127.0.0.1:7775

I think there’s a little confusion here: widgets don’t send messages in response to received messages, it only updates their value. If you want to reply to an incoming message you have to use a custom module.

Edit: or maybe I’m missing the point ? Are you actually testing with the very same session file you sent here ?

Edit 2: ok I get it, I have to send the key value to see the issue, not enter it manually in the input

yes, of curse. When I launch the session every thing work perfectly. But when I modify the key bending, the switch stops to send its OSC message.

What do you mean by sending the key value ? I have the issue when I entre a ney Key value on the input and validate it by a press Enter

Yes but in your setup the value is sent back to open stage control somehow:

(DEBUG, OSC) In:  { address: '/keys', args: [ 1, 'b' ] } From: 127.0.0.1:7775

Maybe it’s a server config issue, but regardless there is a bug with the script widget in keyboard mode.

Found and fixed in sources, to be included in v1.8.1. Still, you might want to check your server config if you didn’t intend to have that osc message loop.

1 Like

Thanks a lot!!

This message loop is requiered by my custom module. It permits to control the shortcut input.

I don’t see how this could be useful, the custom module can already catch outgoing messages, why wait for them to come back ?

On my custom module I check the shortcut value and if it’s not on a list of allow keys I send back the first char of the value to display on the ‘convert’ value.

I just test the new release 1.8.1 and everything seem working fine. Thanks a lot again.