Hmm, this is indeed interesting. I think I can see where they are going but I am not totally sure.
I would describe the virtual devices as being like a wrapper for capabilities. Something like the standard virtual switch has the switch and refresh capabilities with the usual switch attribute and on and off commands so works rather like we are used to. However the standard virtual presence only has the presenceSensor and refresh capabilities so there aren’t any commands to set the presence attribute. The only way to do that seems to be to use the API to send the events (and I found that I had to be the Location owner for those to work). So that isn’t what we are used to, but why should it be?
I haven’t looked to see if the commands implemented are limited to enum and setter commands, which obviously have a direct correspondence with certain attributes. I guess there could be more fancy command mapping to come. Similarly I’d imagine there will the a cloud v local option in future.
On iOS, I can get this with these virtual devices: when I create one, it may show up right away in the mobile and you can tap on it to go into device Controls, but I may get nothing but a blank page - not even a way to navigate back out. The only option is to shut down the app and restart. I repeated this procedure several time last evening then gave up. Today, the device is properly displaying and functional.
Here’s a bit of an anomoly: if you create a refrigerator virtual device, it uses the thermostatCoolingSetpoint capability in both the main and freezer components. However that capability only allows you to set it to a low of freezing (32 degrees F / 0 degrees C). Not very useful for a freezer thermostat where you typically have it a few degrees BELOW freezing.
Have you checked if changing the range in the device-config helps? The capability definition allows a range of -460 - 10000 but I know this and heatingSetpoint are a little tricky, specially related to the unit used in the location and the events.
Note: The value in step depends on the “jumps” you want to allow for the - and + symbols. This way, the value will increase/decrease in that amount. For example,if it’s 0.5, the value will change between 12.0 to 12.5
Could you give me an example of how to create a virtualDevice using the API.
I can list the virtual devices using the following in Postman. https://api.smartthings.com/virtualdevices
but I am at a loss what the URL & body would look like for a POST request to create a virtual device.
I can find nothing in the online API documentation.
Sure, but I should add the disclaimer that there has been no obvious attempt to launch these devices yet and they may not even be ready for us to play with. As the devices are based on capabilities, unless there is a setter or enum command defined in said capabilities there is as yet no way to use them in Routines, Scenes and Rules. Instead you use an API command to specify events, rather like you would with a SmartApp based device. It is clear that the virtual devices will support either local or cloud at some stage, and it is possible that this might involve Edge drivers for the local ones. I simply don’t know. The custom virtual devices seem to have some kind of command mapping feature to come. I don’t know what that is. That said, if you want to create a cloud based virtual switch , this is what the CLI does (tarted up a bit for readability):
I have been able to develop on most of the Virtual prototypes, but the Thermostat is proving challenging. The +/- on the heating and cooling widgets keeps throwing an error as shown. I am able to send an external event to change to the values, but cannot get the iOS or web UI to change. Any help/ideas?