Understanding Command Key and Command Payloads

Understanding Command Key and Command Payloads

Commands executed in Zoho IoT applications send a payload as a JSON message containing essential information. A command key within the payload enables the edge device to identify the specific command and trigger the appropriate actions.

NotesNote: This command key is based on the name defined during the programming of the edge device. Altering the key values can result in device malfunction or unintended behaviour.

Command payload structure:


For example, consider this sample JSON payload sent to the edge device to turn on the light.

Command payload example :

Configuring Command Key

When creating a command, the command key is specified in the Command Key field. You can configure the command key in two ways: as a Direct Parsing String or as an Edge Key.

Direct Parsing String

The Direct Parsing Key refers to the key used in the JSON message's key-value pair.
For example, if "power" is entered in the Command Key field, the following JSON message will be generated when the command is executed.


Edge Key Parsing

Edge Parsing is similar to Direct String Parsing, but with an added information: the edge key specified in the edge name field of an instance (device, asset, location) is prefixed to the generated JSON message.

For instance, if "power" is used as the command key and "ac_1" as the edge name, the resulting JSON file will include the edge name to the key, forming "ac_1.power", and this payload will be sent to the edge device.





InfoLearn More about Edge Keys.

Values

Values in the JSON message are determined by the command executed. The generated value can be Boolean, Decimal, Integer, or Percentage, depending on the user's configuration of the command.
 
For example, consider a payload for controlling the speed of a smart fan. In this, a command uses a command key: set_speed and slider input type with the following configurations: Slider Datatype is set to percentage, the minimum value is 10%, the maximum value is 100%, and the increments are in steps of 10%. When the command is executed with the slider set at 50%, the following payload is generated:







Acknowledgement Payload

When the device receives a command from the Zoho IoT application, it must send an acknowledgement message within 10 seconds to confirm successful receipt. This acknowledgement must adhere to the following JSON structure:

 

A sample implementation is provided below.

 
The status codes corresponding to various events are listed below:

1000 : Acknowledged (Message delivered to device)
1001 : Execution Success (Command executed successfully on device)
4000 : Execution Failure (Command execution on device failed)
4001 : Method Not Found (Device does not recognize the command type)
4002 : Executing Previous Command (Device is busy processing a previous command)
4003 : Insufficient Inputs (Issues understanding the command body contents)
4004 : Device Connectivity Issues (Problem communicating with the device)
4005 : Partial Execution (Some actuators succeeded, others encountered issues)
4006 : Already in Target State (Device or actuator is already in the desired state)

See Also



      Create. Review. Publish.

      Write, edit, collaborate on, and publish documents to different content management platforms.

      Get Started Now


        Access your files securely from anywhere

          Zoho CRM Training Programs

          Learn how to use the best tools for sales force automation and better customer engagement from Zoho's implementation specialists.

          Zoho CRM Training
            Redefine the way you work
            with Zoho Workplace

              Zoho DataPrep Personalized Demo

              If you'd like a personalized walk-through of our data preparation tool, please request a demo and we'll be happy to show you how to get the best out of Zoho DataPrep.

              Zoho CRM Training

                Create, share, and deliver

                beautiful slides from anywhere.

                Get Started Now


                  Zoho Sign now offers specialized one-on-one training for both administrators and developers.

                  BOOK A SESSION







                              Quick LinksWorkflow AutomationData Collection
                              Web FormsRetailOnline Data Collection Tool
                              Embeddable FormsBankingBegin Data Collection
                              Interactive FormsWorkplaceData Collection App
                              CRM FormsCustomer ServiceForms for Solopreneurs
                              Digital FormsMarketingForms for Small Business
                              HTML FormsEducationForms for Enterprise
                              Contact FormsE-commerceForms for any business
                              Lead Generation FormsHealthcareForms for Startups
                              Wordpress FormsCustomer onboardingForms for Small Business
                              No Code FormsConstructionRSVP tool for holidays
                              Free FormsTravelFeatures for Order Forms
                              Prefill FormsNon-Profit
                              Forms for Government
                              Intake FormsLegal
                              Mobile App
                              Form DesignerHR
                              Mobile Forms
                              Card FormsFoodOffline Forms
                              Assign FormsPhotographyMobile Forms Features
                              Translate FormsReal EstateKiosk in Mobile Forms
                              Electronic FormsInsurance
                              Drag & drop form builder

                              Notification Emails for FormsAlternativesSecurity & Compliance
                              Holiday FormsGoogle Forms alternative GDPR
                              Form to PDFJotform alternativeHIPAA Forms
                              Email FormsWufoo alternativeEncrypted Forms
                              Accessible FormsTypeform alternativeSecure Forms

                              WCAG

                                          Create. Review. Publish.

                                          Write, edit, collaborate on, and publish documents to different content management platforms.

                                          Get Started Now






                                                            You are currently viewing the help pages of Qntrl’s earlier version. Click here to view our latest version—Qntrl 3.0's help articles.




                                                                Manage your brands on social media

                                                                  Use cases

                                                                  Make the most of Zoho Desk with the use cases.

                                                                   
                                                                    

                                                                  eBooks

                                                                  Download free eBooks and access a range of topics to get deeper insight on successfully using Zoho Desk.

                                                                   
                                                                    

                                                                  Videos

                                                                  Watch comprehensive videos on features and other important topics that will help you master Zoho Desk.

                                                                   
                                                                    

                                                                  Webinar

                                                                  Sign up for our webinars and learn the Zoho Desk basics, from customization to automation and more

                                                                   
                                                                    
                                                                  • Desk Community Learning Series


                                                                  • Meetups


                                                                  • Ask the Experts


                                                                  • Kbase


                                                                  • Resources


                                                                  • Glossary


                                                                  • Desk Marketplace


                                                                  • MVP Corner



                                                                    Zoho Sheet Resources

                                                                     

                                                                        Zoho Forms Resources


                                                                          Secure your business
                                                                          communication with Zoho Mail


                                                                          Mail on the move with
                                                                          Zoho Mail mobile application

                                                                            Stay on top of your schedule
                                                                            at all times


                                                                            Carry your calendar with you
                                                                            Anytime, anywhere




                                                                                  Zoho Sign Resources

                                                                                    Sign, Paperless!

                                                                                    Sign and send business documents on the go!

                                                                                    Get Started Now




                                                                                            Zoho TeamInbox Resources





                                                                                                      Zoho DataPrep Demo

                                                                                                      Get a personalized demo or POC

                                                                                                      REGISTER NOW


                                                                                                        Design. Discuss. Deliver.

                                                                                                        Create visually engaging stories with Zoho Show.

                                                                                                        Get Started Now









                                                                                                                            • Related Articles

                                                                                                                            • Understanding Command Widgets

                                                                                                                              Command type widgets are used to perform actions such as On/Off, control brightness or volume, etc., on managed entities. You can choose from a list of commands created in the application and associate it with the corresponding widget. These widgets ...
                                                                                                                            • Understanding Certificates

                                                                                                                              In any network where data communication occurs, authentication is crucial for establishing a secure and trustworthy communication channel. In Zoho IoT, Transport Layer Security (TLS) ensures that the data transmitted between the device and the server ...
                                                                                                                            • Understanding Edge Keys

                                                                                                                              Edge Keys in Zoho IOT Applications ensure uniqueness to resources and their corresponding data. They help to distinguish between resources that might have similar or duplicate names in the application. This feature is important in environments where ...
                                                                                                                            • Understanding Model and Instance

                                                                                                                              A model is like a container that can be configured with different templates (datapoints, commands, alarm rules, and fields). Using this model, you can create multiple instances (devices, assets, and locations) with the same setup. Each managed entity ...
                                                                                                                            • Understanding Device Models

                                                                                                                              A device model serves as a blueprint and can be configured with the following : Datapoint templates Command templates Overview dashboards templates Custom fields Alarm rule templates Message Handler and Formatters Model Settings Every device created ...
                                                                                                                              Wherever you are is as good as
                                                                                                                              your workplace

                                                                                                                                Resources

                                                                                                                                Videos

                                                                                                                                Watch comprehensive videos on features and other important topics that will help you master Zoho CRM.



                                                                                                                                eBooks

                                                                                                                                Download free eBooks and access a range of topics to get deeper insight on successfully using Zoho CRM.



                                                                                                                                Webinars

                                                                                                                                Sign up for our webinars and learn the Zoho CRM basics, from customization to sales force automation and more.



                                                                                                                                CRM Tips

                                                                                                                                Make the most of Zoho CRM with these useful tips.



                                                                                                                                  Zoho Show Resources