Is it possible to create a virtual switch with additional properties from another device?

I’ll try to explain what I mean.

I’ve got a virtual switch called “Arm Vacuum”. When it’s toggled ON, SmartThings will run the vacuum at 2AM. I’ve got this going through webcore and it seems to be good to go.

However, in ActionTiles I have two tiles for this vacuum: One from the actual device that displays the battery level, and one for the virtual “Arm Vacuum” switch.

It would be much nicer if I could combine those two ‘devices’ into one virtual device which shows the vacuum’s battery level AND arms the vacuum.

Combining two actiontiles into one is not possible currently, so my only other option is to create a new virtual device that toggles on and off (to arm the vacuum) and can also read/display the vacuum’s battery level. Hopefully ActionTiles would then be able to display the battery AND allow the tile to be toggled on and off.

Is there any way to create a Virtual Device switch which also contains the ‘battery level’ property of a different device?

I think that could be done. You would have to create custom DH for the virtual switch with some code for the battery level including a command that would allow you set it. You could not however directly set the battery level from the device. You would need to use Webcore to read the level from the actual device and then use the custom command to set it your Virtual Switch.

I’m not an expert a coding so I won’t volunteer to do it for you though.

3 Likes

Sure.

You just need to have a SmartApp subscribe to the “battery level” of that “different device” and have it call a custom Command in the Virtual Device to update the Virtual Device’s own “battery level”.

This is likely possible using WebCoRE and so would not require a hand-coded SmartApp; but you still need to create the Custom Virtual Device Handler.

This example below is slightly similar. It adds the switch() Command to a Virtual “Motion Sensor”: