IoT devices interaction (through Cumulocity)

What product/components do you use and which version/fix level?

I am using Cumulocity IoT web platform.

Are you using a free trial or a product with a customer license?

A customer’s license.

What are trying to achieve? Please describe in detail.

What is the recommended/best way for two different IoT devices connected to Cumulocity to link and interact together through the platform (not directly between themselves), so that when the sensor value published by one IoT device reaches a threshold fires up an alarm that is directly transmitted through Cumulocity to the other device so that it fires up an action?

Do you get any error messages? Please provide a full error message screenshot and log file.

None

Have you installed latest fixes for the products

Yes

1 Like

Hi Alvaro,

the recommended way to communicate with Devices are Operations. Streaming Analytics like the Analytics Builder is the perfect Tool to implement such logic.

Step1: From the data model I would create a basic model that will define a threshold and if breached create a specific Alarm on that Device within Cumulocity.
Step 2: In another model (or the same) you can then define this created Alarm as Input and create an Operation of “action” for the Devices you want to interact with.
If the Alarm is already created on the device and transmitted to Cumulocity, you can skip the first part and directly go to Step 2.

Regards
Stefan

1 Like

Hi Stefan,

Many thanks for your quick and precise answer :blush:.

I understand that by Operations you mean the following already by default supported operations:

Operations

500 (get pending)

501,typeToSetToExecuting

502,typeToSetToFailed,fialureReason

503,typeToSetToSuccessful,parameters

510,serial (restart)

511,serial,commandToExecute

513,serial,configurationText

515,serial,firmwareToBeInstalled,version,url

516,serial,softwareToBeInstalled1,version1,url1,sw2,ver2,url2 , …

517,serial,measurementToBeSent

518,serial,relayStatusToBeSet [OPEN/CLOSED]

519,serial,relay1Status,relay2Status, …

520,serial (upload your current configuration)

521,serial,url (download configuration)

522,serial,logFileToBeSend,start,stop,searchText,maxLines

523,serial,communicationMode (SMS/IP)

We already implemented it and performed some tests:

mqttClient.publish(TOPIC_P,0,false, “518,c8y_Serial,OPEN\r\n”);

However, we were not finding the way to properly link an operation coming from a device to fire up an action on a different device. I have just started checking the Analytics Builder you suggested to implement this logic and seems to provide the building blocks for the functionality wanted. We will test it asap. Many thanks :blush:. Could you please point us to a full implementation link or example?

To fully understand the logic and requirements, may you please confirm that once the Operation has been published by one device, everything could be properly configured on the Analytics Builder through its web interface (no code development is required on the Cumulocity side), and the platform will be able to automatically send the notifying message (would it be also be an Operations message?) to the different IoT device, as it was previously assigned on the Analytics Builder? Would there only be code development required on the receiving device to listen and interpret the notifying/fire up message coming from Cumulocity, so the wanted action is executed by the second device?.

Thanks, best regards, Alvaro

~WRD0000.jpg

Hi Alvaro,

yes these are the pre-build operations in MQTT but you can define any operation of your choice.
The Operation concept is a different one you have subscribed:
The Operation itself normally is issued by the platform (UI or Analytics Rule), not by the device. It will be sent to the Device the Operation is assigned to. If you create an operation using MQTT with a device it’s pretty useless as it is also received by the same.

For Analytics Builder the documentation is pretty complete: Reverb
Operation Output: Reverb

I don’t have an example but it can be created very fast. Select a device from the Input as Trigger, Select a device for the Output, Select Operation and make sure that you fill the Properties according the Operation you want to execute.

As stated above: Normally a device does not publish an Operation, it’s the platform. You use any alarm/Measurement/Event and threshold as a trigger from one device, define an operation and send it so any device of your choice. This is a completely no-code approach.

Operations need to be handled by the device and its agent. So you have to subscribe and handle specific types of operations (e.g. c8y_Command, c8y_Configuration etc.). That’s the only part which needs to be developed. Everything else can be configured using Analytics Builder.

1 Like

Hi Stefan,

Many thanks for your clarification about the Operation being issued by the platform and what is needed on each side. It is still going to take me a few more days to be able to focus on this to test it (your answer caught me in the middle of having to pay attention to something else), but I keep you updated as soon as I have additional news.

Thanks for your excellent support.

Best regards, Alvaro

1 Like

Hi Alvaro,

sure! Let me know when you have any update or follow up questions.

Regards

Stefan

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.