No health event is coming

I implemented server with smartthings api.(https://smartthings.developer.samsung.com/docs/api-ref/st-api.html#operation/listSubscriptions)
I unplug the TV to get health event(offline)
but nothing is coming.

to post subscription, below parameters are needed.

  1. accessToken
    client id/secret is obtained with API_ONLY appType and [r:devices:, x:devices:, r:locations:*] scopes.
  2. confirmation
    targetUrl is written and confirmation is done.

then, post https://api.smartthings.com/v1/installedapps/{installedappId}/subscriptoins
with below body.
{
“sourceType”:“DEVICE_HEALTH”,
“deviceHealth”:{
“locationId”:{locationId},
“subscriptionName”:{subscriptionName}
}
}

then, id is returned.

another events are well coming.
DEVICE, DEVICE_LIFECYCLE_EVENT

Hello @jeesun,

The device health subscription is intended to detect critical status, such as low battery, disconnected device (offline) and others.

If you want to detect when the TV is turned off, the subscription should point to the switch capability of the device. For example:

{
  "sourceType": "DEVICE",
  "device": {
    "deviceId": "device-id",
    "componentId": "main",
    "capability": "switch",
    "attribute": "switch",
    "value": "off",
    "stateChangeOnly": true,
    "modes": []
  }
}

For more information about capabilities, you can check this document.

1 Like

thank you for the reply.and sorry about wrong word choice. (Not “turn off” but “unplug”)
I already knew how to get on/off resource changed event. as you mentioned above.
My question is about online/offline health event.
To get offline health event, I pull out the TV plug. (unplug). this makes the TV offline status.

@jeesun This documentation should assist you:

The TV’s device health (online/offline) status is found at:
https://api.smartthings.com/v1/devices/{deviceId}/health

@Brad_ST
thank you for the comment.
but this page is related with api to check health.(not subscription)
this is working well.
in my situation, I posted subscription to the device for the health notification.
but Nothing happend when device went to offline.
offline health notification was supposed to be sent.

I am seeing the same thing.

I used to receive DEVICE_HEALTH_EVENT notifications. It used to work.

Now I don’t see them in my subscription stream, but as you state, I can query the service and get the status, but I don’t want to poll.

UPDATE: Hub devices did receive DEVICE_HEALTH_EVENT, offline, but my WiFi SmartThings plug did not.

I know there is an install issue/option about reporting health, this might be the possible cause.

PaulM

I understand now, thanks @jeesun. And thank you Paul for the additional data point. I took a quick look and it does seem that there might be an issue with device health events for OCF devices such as the TV and outlet. I will investigate further during working hours tomorrow.

@Brad_ST
could you share any updates?