I’m creating a device handler leveraging WEBIOPI which many have done. It works perfect except that I would like to implement a sleep period of 5 seconds in the python which I did. The problem is that when the tile in the smartthings app is pressed it triggers the Pi without issues and performs the sleep() but the device handler never receives a response in the parse method.
If I remove the sleep from the python script smartthings gets the data back to the parse method as expected.
I’m assuming that since there is a delay the parse method is expecting the result back immediately or possibly the sleep kills the response back to the parse method.
I can test the api from postman and it works as expected. If I send a post to webiopi it runs the script, lights up some leds for testing and then returns the appropriate data in a json response.
I was trying to handle the wait on the python side. Should I handle the wait on the smartthings side? The reason I need the wait is because I need the GPIO pin on for a certain amount of time and then turn off.