[ST Edge] Virtual Things Edge Driver

Hi,

Following @TAustin 's great work on vEdge Creator, I was curious to explore a different approach for creating virtual devices.
The driver allows creation of devices one-by-one.

Please install “Virtual Things Edge Driver [YG]”

How to use

After installing the driver, press “Add device” and then “Scan nearby”.
This will create “vDev Controller” - virtual devices controller (currently it only creates virtual devices, but does not actually allow to control them).
Once the controller is created, enter its detailed view.
The user specifies a type of the device to create by choosing “Virtual Thing Type To Create” and presses switch button.
The controller will report its status (ready/creating/created) and the name of the device being created.
When the device is created the switch goes into “Off” state and the controller is ready to create another device.

Note:
Once the virtual devices are created, it is completely fine to delete the Controller. The deletion of the controller should not affect the already created devices in any way.
However, the controller will be automatically created during the next discovery process.

Supported devices

Type                | Capabilities                  | Comments                                                           |
-------------------------------------------------------------------------------------------------------------------------|
Switch              | switch, contactSensor(hidden) | Can be used as a trigger source in Alexa                           |
Dimmer              | switchLevel, switch           |                                                                    |
Curtain Switch      | windowShade, switch           |                                                                    |
Momentary           | momentary, button             | switch (hidden), contactSensor (hidden).Works with Alexa.Since v1.5|
Acceleration sensor | accelerationSensor, switch    | Also contains threeAxis, tamperAlert. Since v1.5                   |
Contact sensor      | contactSensor, switch         | Can be used as a trigger source in Alexa                           |
Motion sensor       | motionSensor, switch          |                                                                    |
Presence sensor     | presenceSensor, switch        |                                                                    |
Smoke Sensor        | smokeDetector, switch         |                                                                    |
Water sensor        | waterSensor, switch           | Since v1.5                                                         |
Alarm               | alarm                         |                                                                    |
Lock                | lock                          |                                                                    |
Thermostat          |                               |                                                                    |
Audio               | mediaPlayback, audioVolume, audioMute, audioTrackData, mediaPresets, mediaTrackControl. Since v1.5 |
Power               | powerMeter, energyMeter       | Since 1.7                                                          |

Controller

The Controller is used to create virtual devices.
It is created by discovery process (Add device → “Scan nearby”). It is safe to delete the controller, once virtual devices are created.
As long as you have the driver installed, the controller will be created on each discovery, if it does not exists.

To create a virtual device

  • enter the Controller’s detailed view
  • press ‘Virtual Thing Type To Create’ and select the desired type
  • Press Switch button

When changing ‘Virtual Thing Type To Create’ in the controller, the controller will show the number of devices of the selected type (Since v1.3).
Please note, after creating the device the info will be empty (not updated with the new number). This to keep creation robust. If the selected device type changes, the info will be updated again.

Update

Since v1.6, Info capability can show

  • The number of created device of the selected type. This is the fastest option
  • The list of devices of the selected type and their number (This is the default option)
  • The list of all devices, created by the driver. The devices of the selected type will be shown in bold and in ‘Blue Violet’ color
    Please note, this is the slowest option, might not work well with large number of devices

The desired info capability format can be specified in Controller’s settings.

Many thanks to @TAustin and @philh30 for their help and the idea to use HTML tags

Controller’s view

Detailed view Info field, populated with created devices

Selecting the device type to create

Virtual switch

The virtual switches allow changing the icon (Since v1.3) by selecting device profile.
The profile is selected in ‘Settings’.

There is a special ‘Simple switch’ profile that does not contain contactSensor capability.
This is useful to prevent STHM event. However, when selecting this profile, the device can not be used as a trigger for Alexa routine.

Switch with any profile, except ‘Simple switch’ can be used in Alexa as both a source (‘When it happens’ ) and as a destination (‘Action’).
‘Simple switch’ can be only a destination for Alexa routine.

The supported profiles are

  • switch
  • light
  • smart plug
  • dishwasher
  • dryer
  • fan
  • garage door
  • robot cleaner
  • stove
  • washer
  • TV (since v1.4)
  • camera (since v1.4)
  • leak sensor (since v1.5)
  • Simple switch (since v1.7)

Virtual Momentary button

The momentary button is a stateless switch which allows you to define an action when a button is pressed.
The device contains a momentary capability to trigger the action and button capability with only ‘pressed’ action.
The device allows to select profile in ‘Settings’.

The following profiles are supported:

  • With hidden contact sensor
    The device can be used in Alexa as both a source (‘When it happens’ ) and as a destination (‘Action’).
    When defining the Alexa routine, please note, the the device will be shown as a door sensor for routine’s trigger and as a switch for routine’s action.
    Please also note, this device will trigger STHM alerts
  • Simple profile
    With this profile, the device can be used in Alexa as a destination (‘Action’). However it can’t be used as a source (‘When it happens’ ) for routine. It will not trigger STHM alerts

The device contains the following capabilities

  • momentary
  • button
  • switch (hidden), required for Alexa routine’s action
  • contactSensor (hidden), required for triggering Alexa routines

Pressing momentary have the following effects

  • momentary’s state changes from ‘Standby’ to ‘Press momentary’, then back to ‘Standby’
  • button’s states changes from ‘Standby’ to ‘Pressed’, then back to ‘Standby’
  • switch’s state is changed to ‘on’ and after approximately 2 seconds back to ‘off’
  • contact sensor is changed to ‘open’ and after approximately 2 seconds back to ‘closed’

Virtual Acceleration sensor

The device contains the following capabilities

  • accelerationSensor
  • switch
  • threeAxis
  • tamperAlert

Pressing a switch changes acceleration sensor from ‘No vibration’ to ‘Vibration detected’.
Other capabilities can be controlled through API/WebCore.

Virtual Alarm

Virtual alarm contains alarm capability, that can be used in both ‘IF’ and ‘THEN’ statements of the routine.

Supported alarm types

  • Off
  • Strobe
  • Siren
  • Siren and Strobe

Virtual Audio

(Since v1.5)

Change log

v1.7 2022-05-30T06:21:13.138967863Z

New things:

  • vPower

vSwitch:

  • rename ‘Switch icon’ setting to ‘Switch profile’
  • add ‘Simple switch’ profile without contact sensor capability

vMomentary:

  • add ‘Device Profile’ setting
  • add ‘Simple profile’ profile without contact sensor

v1.6 2022-02-07T20:47:12.309967

Add ability to display all virtual devices, created by this driver in Info field.

See Controller section for more details

v1.5.1 2022-01-30T05:12:43.493124Z

Force controller’s initialization during driver’s update

v1.5 2022-01-29T18:36:54.682876Z

New things:

  • Momentary
  • Acceleration sensor
  • Water sensor
  • Audio

vSwitch:

  • add Leak sensor icon to vSwitch

Thanks

I’d like to take this opportunity to thank @nayelyz , @erickv and @psbarrett for their help.

20 Likes

Thanks. This is more simple to use than driver @TAustin made. And all virtual devices were found by Alexa. Great example how these drivers evolve over time. :+1::blush:

1 Like

Thanks very much for creating and sharing this, it is nice and easy to use.

1 Like

Great work! Do you intend to add the virtual thermostat?

1 Like

Hi @sulisenator ,

Could you please elaborate, how could it be used and/or what capabilities are needed for it?
Thanks

Just a virtual device with the usual parameters of a thermostat, to integrate a non-compatible thermostat or A/C (I do that with nodered, I grab the data from the device via API and replicate them on the virtual device, and viceversa)

IT was done in the edge driver you based this on.

@sulisenator I can give it a try.
Don’t you need the temperature capability to be able to set the current temperature?
So the virtual thermostat would compare the provided temperature with cooling and heating settings and apply the mode accordingly?
Or you need only to reflect the external mode?

@ygerlovin
There is groovy smart app ”Virtual Thermostat with Devices” that creates virtual thermostat device, that is linked through smart app, to temperature sensor, and to outlets/plugs, that can be turned on or off, when temperature is compared with actual and set temperature for cooling or heating, depending on set mode.
Pretty much settings have links to:

  • Temperature sensor
  • Heating device
  • Cooling device

Beauty of this solution is Simplicity, as you set desired temperatures, and you leave app alone. If you want to increase/decrease temperature, you just do it by adjusting virtual thermostat. No complicated Automations.

This app will be gone when groovy is gone.
There is need for this virtual device, to links sensors and non smart fans and heaters that are plugged in.

1 Like

@sulisenator @milandjurovic71
Do you mean something like that or without the temparature measurement?

@ygerlovin
Something like that or any other standard Thermostat.
This what I have with ecobee


Temperature and humidity should come from any device that supports both capabilities.
As you said, Heating Temperature should trigger another device On (with switch capabilities) for any temperature lower than set, coming from sensor, below set Heating, and, Cooling temperature should have device On for any temperature above set.
If possible to add third option just to have circulation device, that would be great.

Fan Mode is usually On, Auto and Circulation
Thermostat modes are usually
Auto, Cool, Heat and Off, and some have Emergency.

If for example thermostat is in Heating mode, it would triger Heating device. If it’s in Cooling it would trigger Cooling device (switch or plug), and if in Circulation another one.

1 Like

@milandjurovic71
Thank you for your clarifications.

So please let me see if I understand correctly.

  1. The virtual thermostat should get temperature and humidity values from external sensors
  2. The state should be calculated as follows
    If the mode is ‘Heat’ it should be ‘heating’
    If the mode is ‘Cool’ - ‘cooling’
    If the mode is ‘Auto’ it will be calculated, based on temperature reading and heating/cooling settings
  3. I think the heating/cooling switches can be triggered with simple automation, based on calculated operating state
    (If ‘heating’, turn on heating switch, turn off cooling switch. If cooling, turn off heating switch, turn on cooling switch)
  4. Fan switch can be controlled with automation, based on fan mode and perhaps on humidity value.

If this seems to be OK, I will take a look at possibility to feed the virtual device with temperature/humidity values. I’m not sure the edge driver can be fed with values from external sensors

1 Like

@ygerlovin
Maybe I did not explain well. Lets start again :grinning:. Virtual Thermostat should behave like real thermostat, only difference would be where Current temperature is coming from, and what is activated when thermostat status changes from Idle.
When HVAC Mode is set to Heat the virtual thermostat would compare the sensor provided temperature with heating settings and turn selected device On, and when provided temperature is equal with Heating Settings than it will turn device off.


When HVAC Mode is set to Cool the virtual thermostat would compare the sensor provided temperature with cooling settings and turn selected device On, and when provided temperature is equal with cooling Settings than it will turn device off.


When HVAC mode is set to Off, it should not be doing anything, and all connected devices should be turned off.

When HVAC Mode is set to Auto the virtual thermostat would compare the sensor provided temperature with cooling and Heating settings and turn selected device On when provided temperature is not between cooling and heating temperatures, and when provided temperature is whithin range with cooling and heating settings than it will turn device off.



Maybe this will clear more

1 Like

After I had some problems today with Smartthings, all automayion and scenes got deleted, these virtual devices made with this driver seem to go offline straight after they are created. I tried several different devices. Then deleted the driver, installed it again and now even vDevController seems to be offline. :thinking:

Hi @Sakari ,
I’m sorry to hear the driver didn’t work for you.
Do you see the devices are being offline also in IDE or only in the APP?
If the devices are shown online in IDE, but offline in the APP, perhaps cleaning the app cache would help.
Would it be possible to provide the logs from the driver?
During development, I have experienced devices being offline if the new driver’s version is not installed properly. However, I published only a single version without any upgrades to the Beta channel, so I’m not sure how that could be related.
Further, the driver has no access to automations. It can’t just delete them.
I would suggest to contact ST support regarding this. They should be able to pull the logs directly from your hub.
As a last resort, I would suggest to reboot the hub. However, in this case, the hub logs would be probably lost, so it should be done only after contacting support.

I think this problem with automation getting deleted was different but happened about at the same time. It messed up many of my devices. Virtual devices used to work ok until that point. But I’ll try to clear cache and see if it has any effect.

hi Yakov,

I tried to install your Virtual Driver to my ST hub. i’m unable to change the Virtual Thing Type. Here’s what i’m getting.

It just says checking…
image
then when i try to chose the type, it loads (or reads) for a while then gives the error below.


I already tried uninstalling and reinstalling the driver. Restarted the Hub but still it didn’t help. do you have any idea how to fix this?

Thanks.

@averagebald
Do I understand correctly that you are unable to choose the type of virtual thing to create?
Or you get network error when pressing the switch button to create the device?

Also, would it be possible to collect the driver logs from smarthings cli?
Thanks

after selecting the device type, i get this loading icon. And then, it returns the network or server error.
image

are these the logs you are referring to?
image

I deleted the driver and installed it again. Now I’m stuck in this checking state too. :thinking:

1 Like

Hi @Sakari and @averagebald ,

I suspect that there is an issue with the platform that somehow propagates the changes to driver that I post only to my private development channel, not to your Beta channel.

The new version will have additional virtual things to create and therefore the old controller does not understand the new capability.

I will try to see whether I can provide an urgent fix and will update as soon as I have some solution.

I would also suggest to delete the driver and unenroll from the channel, clean the cache in the app and then enroll again and install the driver.

2 Likes