EMQPERSIST – report a set value to the device shadow
Report a set value to the device shadow/twin. The operation depends on which AWSSHADOW mode you set, either simple or complete.
AWSSHADOW simple mode
The shadow ETM performs the following automatically:
Generates the JSON
stateandreportedordesiredobjectsSubscribes to the
shadow/update/deltatopic, and filters out the containing objectsPresents the host with the state object JSON content only, sent via URC
The host only sends the content of the reported object.
AWSSHADOW complete mode
The host sends the complete JSON for the shadow to ETM.
ETM sends the complete shadow message as a URC, without filtering.
EMQPERSIST commands
Test
AT+EMQPERSIST=?
OK
EMQPERSIST:<json>
Read
AT+EMQPERSIST?
OK
or
ERROR
Write
AT+EMQPERSIST=<JSON>
where JSON is the JSON code, which depends on the AWSSHADOW mode you configured.
For simple mode:
Either the content of the statereported object or desired object is required, in this format:
AT+EMQPERSIST="{\"key\":value}"
where value is a numeric value, including decimals and negative numbers.
If the passed-in text does not include reported or desired, then reported is assumed. The state reported encapsulation is appended.
If the passed-in text includes reported and/or desired, only the state encapsulation is appended.
For example, for the reported text:
"{\"key\":\"value\"}" and
"{\"reported\":{\"key\":\"value\"}}" are both sent as
{\"state\":{\"reported\":{\"key\":\"value\"}}}
For example, for reported and desired text:
"{\"reported\":{\"key\":\"value\"},\"desired\":{\"key\":\"value\"}}" is sent as
{\"state\":{\"reported\":{\"key\":\"value\"},\"desired\":{\"key\":\"value\"}}}.
For complete mode:
The complete JSON data for the shadow/update topic is required, in this format:
AT+EMQPERSIST="{\"state\":{\"reported\":{\"key\":value}}}"
where value is a numeric value, including decimals and negative numbers.
OK
SEND OK
or
ERROR
Examples
For Simple mode:
For Complete mode, including setting AWSSHADOW to complete:
Last updated
Was this helpful?