Jump to content
🌟 NOTIFICATION/Benachrichtigung: Welcome to our New Store! - shelly.com 🌟 ×

FeatureRequest: virtualHandler.on() should have also a "set" event.


Recommended Posts

  • Members

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.

Link to comment
Share on other sites

Join the conversation

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

Guest
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...