Open Messaging Interface (O-MI), an Open Group Internet of Things (IoT) Standard – Example Messages

 

This appendix shows example messages for some basic cases. More examples are normally available at the website(s) where this specification is published.

Read Request Example

<?xml version="1.0" encoding="UTF-8"?> <!-- Example of a simple read message using PMI payload. Namespace based validation included. --> <omi:omiEnvelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:omi="omi.xsd" xsi:schemaLocation="omi.xsd omi.xsd" version="1.0" ttl="10">     <omi:read msgformat="omi.xsd">         <!-- Here could be a list of destination nodes if the message can't be sent directly to the destination node(s). -->         <omi:msg xmlns="odf.xsd" xsi:schemaLocation="odf.xsd odf.xsd">             <Objects>                 <Object>                     <id>SmartFridge22334411</id>                         <InfoItem name="PowerConsumption">                     </InfoItem>                 </Object>             </Objects>         </omi:msg>     </omi:read> </omi:omiEnvelope>

Read Response

<!-- Example of a simple reply message using “odf” payload. Namespace based validation included. --> <omi:omiEnvelope xmlns:omi="omi.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="omi.xsd omi.xsd" version="1.0" ttl="10">     <omi:response>         <omi:result msgformat="odf">             <omi:return returnCode="200"></omi:return>             <omi:requestID>REQ654534</omi:requestID>             <omi:msg xmlns="odf.xsd" xsi:schemaLocation="odf.xsd odf.xsd">             <Objects>                 <Object>                     <id>SmartFridge22334411</id>                         <!-- Only most recent value, bogus timestamp. -->                         <InfoItem name="PowerConsumption">                             <value type="xs:int" unixTime="5453563">43</value>                         </InfoItem>                 </Object>             </Objects>             </omi:msg>         </omi:result>     </omi:response> </omi:omiEnvelope>

Read Response Metadata Example

<!-- Example of a response message to metadata request using OMI_d payload. Namespace based validation included. --> <omi:omiEnvelope xmlns:omi="omi.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="omi.xsd omi.xsd" version="1.0" ttl="10">     <omi:response>         <omi:result msgformat="odf">             <omi:return returnCode="200"></omi:return>             <omi:requestID>REQ654534</omi:requestID>             <omi:msg xmlns="odf.xsd" xsi:schemaLocation="odf.xsd odf.xsd">             <Objects>                 <Object>                     <id>SmartFridge22334411</id>                     <InfoItem name="PowerConsumption">                         <MetaData>                             <InfoItem name="format"><value type="xs:string">xs:double</value></InfoItem>                             <InfoItem name="latency"><value type="xs:int">5</value></InfoItem>                             <InfoItem name="readable"><value type="xs:boolean">true</value></InfoItem>                             <InfoItem name="writable"><value type="xs:boolean">false</value></InfoItem>                             <InfoItem name="unit"><value type="xs:string">Watts</value></InfoItem>                             <InfoItem name="accuracy"><value type="xs:double">1</value></InfoItem>                         </MetaData>                     </InfoItem>                 </Object>             </Objects>             </omi:msg>         </omi:result>     </omi:response> </omi:omiEnvelope>

Multiple Payload Response Example

<!-- Example of a  response message using several different payloads. --> <omi:omiEnvelope xmlns:omi="omi.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="omi.xsd omi.xsd" version="1.0" ttl="10">     <omi:response>         <omi:result msgformat="obix">             <omi:return returnCode="200"></omi:return>             <omi:requestID>REQ0011212121212</omi:requestID>             <omi:msg xsi:schemaLocation="http://obix.org/ns/schema/1.0 obix.xsd" xmlns="http://obix.org/ns/schema/1.0">                 <obj href="http://myhome/thermostat" >                 <real name="spaceTemp" unit="obix:units/fahrenheit" val="67.2"/>                 <real name="setpoint" unit="obix:units/fahrenheit" val="72.0"/>             <bool name="furnaceOn" val="true"/>                 </obj>             </omi:msg>         </omi:result>         <omi:result msgformat="CSV">             <omi:return returnCode="200"></omi:return>             <omi:requestID>REQ232323</omi:requestID>             <omi:msg>11,22,33                                 44,55,66</omi:msg>         </omi:result>         <omi:result msgformat="odf">             <omi:return returnCode="200"></omi:return>             <omi:requestID>REQ654534</omi:requestID>             <omi:msg  xmlns="odf.xsd" xsi:schemaLocation="odf.xsd odf.xsd">             <Objects>                 <Object>                     <id>SmartFridge22334411</id>                     <InfoItem name="PowerConsumption"><value>43</value></InfoItem>                 </Object>             </Objects>             </omi:msg>         </omi:result>     </omi:response> </omi:omiEnvelope>

Write Request

<?xml version="1.0" encoding="UTF-8"?> <omi:omiEnvelope xmlns:omi="omi.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="omi.xsd omi.xsd" version="1.0" ttl="-1">     <omi:write msgformat="odf" targetType="device">         <omi:msg xmlns="odf.xsd" xsi:schemaLocation="odf.xsd odf.xsd">             <Objects>                 <Object>                     <id>SmartFridge22334411</id>                     <InfoItem name="FridgeTemperatureSetpoint"><value>3.5</value></InfoItem>                     <InfoItem name="FreezerTemperatureSetpoint"><value>-20.0</value></InfoItem>                 </Object>             </Objects>         </omi:msg>     </omi:write> </omi:omiEnvelope>

Error Response

<!-- Example of an error response. --> <omi:omiEnvelope xmlns:omi="omi.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="omi.xsd omi.xsd" version="1.0" ttl="0">     <omi:response>         <omi:result>             <omi:return returnCode="404"></omi:return>         </omi:result>     </omi:response> </omi:omiEnvelope>

Cancel Request

<?xml version="1.0" encoding="UTF-8"?> <!-- Example of O-MI cancel message for cancelling two requests with different request IDs. --> <omi:omiEnvelope xmlns:omi="omi.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="omi.xsd omi.xsd" version="1.0" ttl="10">     <omi:cancel>         <omi:requestID>REQ0011212121212</omi:requestID>         <omi:requestID>REQ0011212121213</omi:requestID>     </omi:cancel> </omi:omiEnvelope>