Need to simulate a switched power outlet

Hi all
for testing i need to set up a virtual or simulated switch
that when is on would simulate a power outlet put out 200w
what the best way to do this

Make a copy of the Virtual Switch code and add an ad hoc custom Command (or method) set the power Attribute (via sendEvent) whenever the on() event is triggered.

I have found self-triggering events are sometimes not reliable, so you might use a SmartApp subscribed to the on()/off() Events of the Device, that call the ad hoc custom Command.

Here’s the starting point (i.e,. the Virtual Switch DTH code)…