Generating Custom Logs at SmartThings Platform

Hi,
I am doing research on IoT security. Because of my research topic, I need to work with the SmartThings platform to implement and test our idea. More specifically, I am working in the IoT forensics area, and I need to have some specific logs as data from a smart home/office, which are not available on the SmartThings platform. For example, If an event happens in the platform, I need to log the source of that event during the runtime (e.g., which device handler or smart application was the source of a particular event). I have gone through the documentation about the SmartThings platform and APIs, but I couldn’t find the answer to my question. Is it possible to generate different types of customized logs during the platform’s runtime from the developer’s workspace?

Welcome to the SmartThings Community, @ehsankhodayar!

No, unless you create a custom handler for the device and include a custom capability to have the normal attribute value and the origin (another attribute) depending on where the event for the capability is generated.
Note: Up to now, custom capabilities support displaying only one attribute in the app

Otherwise, the source of the event is not differentiated, it doesn’t matter from where the event is received, at the end, it is taken by the device handler (ST Schema, Edge Driver, Direct-Connected, etc.) and those events don’t include that property (“source”).
For example, if you send a command from a SmartApp, it will hit the capability event handler in the device’s handler. If there’s no handler registered for that specific command of the capability, you will receive an error (in the app, “network error”) or a message that the command was accepted (but not processed > that mainly happens in commands sent directly through the API).

Thank you so much for the information. Just one more question, is there anyway to intercept messages that are being transferred between the platform and smart apps? For example, I want to have a program which receives such messages whenever a smart app sends some messages to the platform or vice versa. Accordingly, I can log those messages by my program.

No, maybe if it’s a custom SmartApp, you could send that event to another cloud and the response to ST.
But, you cannot intercept the commands coming from an internal SmartApp (SmartLighting, Thermostat, etc.)
Normally, to receive actively the events of the devices, we create subscriptions. They can only be created using an Access Token from an OAuth integration or a SmartApp.

Note: The first one is not currently available as the team is working on some improvements for this tool

To get the device event history, you can send a request to the following endpoint:

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

Where xxx-xxx-xxx is the locationId, you can filter the result by adding another query parameter:

&deviceId=xxx-xxx-xxx

Please, let me know if you have any questions.

Thank you very much for your reply. I have gone through the SmartThings API documentation, and I couldn’t understand well one of its options for Services (i.e., smart apps) according to the given explanations. The option name is “create Installed App Events” (https://developer-preview.smartthings.com/docs/api/public/#operation/createInstalledAppEvents). Can you let me know what it is exactly? For example, can we set some custom events for different behaviors of smart apps and trigger them whenever they happen?

In the Core SDK, there’s a note that this was placed for future functionality that is not available yet.
I’ll contact the corresponding team to see if they can provide more info.

Thank you for the collaboration.