-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpayloadMapping.txt
1 lines (1 loc) · 1.05 KB
/
payloadMapping.txt
1
function mapToDittoProtocolMsg(headers, textPayload, bytePayload, contentType) { const thingId = 'UDMIduino-000'; const jsonString = String.fromCharCode.apply(null, new Uint8Array(bytePayload)); const jsonData = JSON.parse(jsonString); const value = { udmi: { properties: { version: 1, timestamp: 0, points: { lux_level: { present_value: jsonData.points.lux_level.present_value }, lum_value: { present_value: jsonData.points.lum_value.present_value }, dimmer_value: { present_value: jsonData.points.dimmer_value.present_value } } } } }; return Ditto.buildDittoProtocolMsg( 'arup.eight.fitzroy', thingId, 'things', 'twin', 'commands', 'modify', '/features', headers, value ); }