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.
How would I do this? I see the range in the device presentation and I donβt know how to change that short of creating a custom capability and presentation.
What are you referring to here? An option would be to create a custom capability but remember those are not supported in some third-party integrations like Alexa.
To change the range of a capability (this affects only the presentation, not the definition), you need to do something like this in the device-config to create a custom presentation:
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
I see that Isabelle has created a pull request for a Virtual Switch driver (covers switch, dimmer and dimmer-switch). Looks stateless to match the DTH. Interesting.
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):
As it is a switch it has on and off commands that do the obvious thing. However just to show how it works for other virtual devices, this is how the switch could be turned off:
I donβt know what the deal is with the βstate changeβ value on these devices. I think it may default to on, at least for the switch. I donβt know if there is a way to turn it off.
I am not recommending to anyone to do any of the above. I am just a reporter. I didnβt uncork the bottle.
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?