I am trying to post an event to a Door sensor device using API.
My access token has all the permissions and I can successfully use the API for other endpoints.
My device is a “Simulated Contact Sensor”. I also tried with a “Contact Sensor Capability” device.
Historically device type handlers included custom commands. The modern approach is custom capabilities.
I have only seen deviceEvents used in two circumstances. One is with devices of type APP where the device integration is an app and the deviceEvents call is the equivalent of a createEvent/sendEvent in a DTH or emitting events in an Edge driver, that is to say it originates internally to the integration.
The other is with devices of type VIRTUAL, which haven’t really been introduced to us yet, where the deviceEvents can indeed be used in the way you describe, that is originating externally to the device integration.
It’s never really occurred to me that you might be able to do it more generally.
Let’s tag @nayelyz here as she might be able to clarify things.
@orangebucket is right, those events are for devices managed by a SmartApp Connector, this means an Access token that doesn’t belong to the SmartApp that controls the device can’t send this type of event.
Also, as this capability doesn’t have a command we can use, the device integration should handle the generation of the events.
Did you create the “Simulated Contact Sensor” through the IDE?
There are other ways to create a virtual device where you would have control over the events:
Also, the complete info about virtual devices hasn’t been provided by the team as Graham mentioned, but, the ST CLI has some commands available to create and send events to virtual devices, I just made a test for a contact sensor and it worked: