Members mschaeffler Posted July 6 Members Share Posted July 6 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. Quote Translate Revert translation? English (American) Finnish French German Italian Portuguese (European) Spanish Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.