I have the following working code:
The delay(10000) is the only way I’ve found to get it to work. There seems to be some delay between publishing the event and the cloud contacting the device to retrieve ir. Is there a better way to do this i.e. wait for event to be published function?