Pointers for a virtual edge device connecting to physical devices

Hi everyone, trying to write an edge driver and need some pointers. Where do I learn what an edge driver can access vs the api? I am trying to write a virtual edge driver to discovery a humidity/temp sensor in the same room and then alert via a virtual contact sensor when the temperature crosses the dewpoint threshold. From and edge driver can you discover the room? From an edge driver can you discover devices in the room? Can you subscribe to events from a device not associated with the driver? I have this working as a physical zigbee humidity sensor driver, but I’d like to virtualize it to work with any humidity sensor. If I can’t subscribe to events from another edge device in the virtual driver is there a way that the to define the capabilities so the rules builder when you select the “dewpoint” device will let you select as input a device? The routine would look like if humidty>0 and temperature > than -4 then dewpoint (that was set to take inputs from a same humidity sensor).

This thread should answer some of your questions:

As you can see, we need a rule to mirror the attributes from one device to another.

1 Like

Hi, @Keith_Collins

In case you haven’t resolved your questions yet. Here’s some feedback:

An edge driver can be used only to integrate a device into the platform and handle its events.
The API helps you interact with the existing devices and you can see their metadata when you list them. For example: roomId, capabilities, profile, driverID, etc.

In this case, the trigger of the automation would be the temperature change.
The “problem” would be the virtual contact sensor since the capability “contactSensor” doesn’t have commands configured which means you cannot use it in the “then” part of a rule or routine. Is there a particular reason on why it is a virtual contact sensor instead of a virtual switch?

No, you can only list the rooms that exist in a location through the API: API | Developer Documentation | SmartThings
The devices endpoint allows you to use the parameter “roomId” to get only the devices that belong to that room. For example:

https://api.smartthings.com/v1/devices?roomId=xxx-xxx

Subscriptions are a concept only for installedApps (SmartApps, OAuth integrations), and you can get the events from any device but Edge drivers can control only devices “connected” through them and not external devices since drivers have no Internet access, so, you cannot use requests to the API from there either.

The options you get in the routines depend on the capability’s configuration, if it doesn’t have a command that can be used to set the attribute’s value, you won’t see it as “input” (this means in the “then” part).
So, you can set a rule with the interval as mentioned in the post shared by @Andreas_Roedl.
Because the alternative would be creating a custom capability similar to “relativeHumidityMeasurement” but adding commands to set them. Consider that custom capabilities won’t appear in integrations like Alexa or the tiles in the “Favorites” section.