Smartthings app is not receiving status from samsung smart things server

Hello,

We have a smart things app created and we use it to detect and show alerts for SmartSense Multi Sensor i.e. a door sensor device, in our mobile app to user

Flow of app in brief:

The user logs in the samsung smart things account from our mobile app
then authorizes using the samsung smart things authorization flow and selects device (SmartSense Multi Sensor i.e. door sensor) and clicks submit, then our mobile app is connected with samsung smart things app

The smart things app will now inform our mobile app whenever the door device is opened or closed, and is working fine, but sometimes it happens so, that though the device’s status is changed, the samsung server does not respond and send exact status

Please help me and let me know what should I do next as am held up due to this

Please find the app details:

Code: attached code

definition(
name: “EM SmartThings API App”,
namespace: “smartthing-em”,
author: “Keval Parekh”,
description: "This app will show the status of door sensors. ",
category: “Convenience”,
iconUrl: “https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience.png”,
iconX2Url: “https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience@2x.png”,
iconX3Url: “https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience@2x.png”,
oauth: true)

preferences(oauthPage: “deviceAuthorization”) {
page(name: “deviceAuthorization”){
section(“Allow Endpoint to Control These Things…”) {
input “doorsensors”, “capability.contactSensor”, title: “Which Door?”, multiple: true, required: false
}
}
}

mappings {
//Doors
path("/doorsensors") {
action: [
GET: “listDoorSensors”
]
}
path("/doorsensors/:id") {
action: [
GET: “showDoorSensor”
]
}
path("/doorsensors/:id/:events") {
action: [
GET: “showDoorSensorEvents”
]
}
}

def installed() {
log.debug "Installed with settings: ${settings}"
initialize()
}

def updated() {
log.debug "Updated with settings: ${settings}"
unsubscribe()
initialize()
}

def initialize() {
subscribe(doorsensors, “contact.closed”, DoorSensorDeviceHandler)
subscribe(doorsensors, “contact.open”, DoorSensorDeviceHandler)
}

//Handler for door sensor
def DoorSensorDeviceHandler(evt){
log.debug “Door status changed to ${evt.value}”
//This URL will notify user for door sensor change event
httpPost(uri: “{our_server_url}/smart_home_user_notifications.php?deviceId=${evt.deviceId}&deviceValue=${evt.value}&isoDate=${evt.isoDate}”)
{
resp -> log.debug “response data: ${resp.data}“
log.debug evt.name+” Event data successfully posted”
}
}

//Door Sensor Methods

//This method will get all door sensors
def listDoorSensors() {
doorsensors?.collect{[type: “door”, id: it.id, name: it.displayName, status: it.currentValue(‘contact’)]}?.sort{it.name}
}

//This method will get detail for specified door sensor
def showDoorSensor() {
show(doorsensors, “contact”)
}

//This method will fetch the event for specified door sensor
def showDoorSensorEvents() {
log.debug "called…"
getEvents(doorsensors, “status”)
}

private show(devices, type) {
def device = devices.find { it.id == params.id }
if (!device) {
httpError(404, “Device not found”)
}
else {
def attributeName = type == “motionSensor” ? “motion” : type
def s = device.currentState(attributeName)
[id: device.id, label: device.displayName, value: s?.value, unitTime: s?.date?.time, type: type]
}
}

private getEvents(devices, type) {
log.debug " events data requested…"
def device = devices.find { it.id == params.id }
if (!device) {
httpError(404, “Device not found”)
}
else {
def events = device.eventsSince(new Date() - 364)
events = events.findAll{it.name == type}
def result = events.collect{item(device, it)}
result
}
}

private item(device, s) {
device && s ? [uid: s.id, device_id: device.id, label: device.displayName, name: s.name, value: s.value, date: s.date] : null
}

private device(it, type) {
it ? [id: it.id, label: it.label, type: type] : null
}

Thanks and Regards,
Keval M.Parekh

ANybody there, who can help us with their expirirence and knowledge, please help , thanks in advance

Please need help, we are trying from our side but are new to this concept, so your help would be invaluable
thanks