Complete the code to start the edge translator service.
edge_translator.start([1])The service requires the configuration file config.yaml to start properly.
Complete the code to translate MQTT messages to CoAP format.
translator.convert('mqtt', 'coap', message[1])
The payload property contains the actual message data to translate.
Fix the error in the code to correctly map CoAP requests to MQTT topics.
mapping = {req.topic: req[1] for req in coap_requests}The payload contains the data to be sent to the MQTT topic.
Fill both blanks to filter and translate only temperature sensor data.
filtered = {msg[1]: translator.convert('mqtt', 'coap', msg[2]) for msg in messages if 'temperature' in msg.topic}The dictionary keys are message topics, and the values are the converted payloads.
Fill all three blanks to create a mapping of device IDs to their latest translated messages.
latest_messages = [1]{msg.device_id: translator.convert([2], [3], msg.payload) for msg in device_msgs if msg.status == 'active'}
We use dict( to create a dictionary, translating from MQTT to CoAP for active devices.
