It would really help if you provided a screenshot of your relevant blocks, so we can see what you are trying to do, and where the problem may be.
To get an image of your blocks, right click in the Blocks Editor and select "Download Blocks as Image". You might want to use an image editor to crop etc. if required. Then post it here in the community.
You have to constantly send (i.e. poll) something to the device. As soon as you get error 516 you know, that the device disconnected
EDIT: see an example here
Taifun
Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by
Taifun.