I’m new to the imp and I’m trying to do something that I thought you be fairly simple.
I’m trying to have an agent that retrieves the value of the state of a pin and respond with the value in the body of the response. But I cannot accomplish this, it seems the only way to do this is to send a message to the device and have a listener in the agent but that basically prevents me from replying with the value in the same transaction.
In your case, you want to read a pin, so you could do something like this at the device:
local pin9State = hardware.pin9.read() (Assuming you were using Pin 9), and then send it to the agent, where you would respond back to your request.