Jump to content
⚠️ Deprecation Notice: Cloud Control API V1 – Switch to V2 ×

Recommended Posts

  • Members
Posted

The ".on" event handler of virtual components should also have a "set" event, so that you could also get every setting and not only changes of the virtual component.

Here is one example:

const enum200 = Virtual.getHandle( "enum:200" );
enum200.on( "set",
    function(event)
    {
        print( event.value );
        if( event.value === "S" )
        {
            switchOn( "S" );
        }
        else if( event.value === "D" )
        {
            switchOn( "D" );
        }
        else if( event.value === "L" )
        {
            switchOn( "L" );
        }
        else if( event.value === "-" )
        {
            switchOff();
        }
    }
);

At the moment I'm simulating this by subscribing to the MQTT topic ".../rpc" and checking the method value, but this is quite a hack and works just with changes via MQTT.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...