Resources

Renesas IoT Sandbox Documentation

MQTT Library

The MQTT Library functions provide access to publish/subscribe using MQTT protocol.

Import


To use this library and its functions, you must use the import line at the beginning of your Base Python code.

import MQTT


Functions


MQTT.publish_event_to_client

Usage: MQTT.publish_event_to_client(device, payload, encoding='utf-8')

Publishes the string payload encoded as encoding via the Renesas IoT Sandbox MQTT broker to the topic 1/<project_mqtt_id>/<user_mqtt_id>/<device>/event , where <project_mqtt_id> is the project specific MQTT hash which can be found at https://app-renesas-na-sandbox.mediumone.com/#/admin/mqtt and <user_mqtt_id> is the MQTT hash of the basic user running the workflow which can be found from the REST API /v2/users or /v2/users/<login_id> endpoints.

  • Credit cost: 1
  • Parameters:
    • device: str|unicode Sub-division of topic to publish to.
    • payload: str|unicode Data to publish.
    • encoding: str|unicode Encoding of payload. Supported encodings: utf-8, latin1
  • Returns: None



MQTT.publish_update_to_client

Usage: MQTT.publish_update_to_client(device, update_type, payload, encoding='utf-8')

Publishes the string payload encoded as encoding via the Renesas IoT Sandbox MQTT broker to the topic 1/<project_mqtt_id>/<user_mqtt_id>/<device>/update/<update_type> , where <project_mqtt_id> is the project specific MQTT hash which can be found at https://app-renesas-na-sandbox.mediumone.com/#/admin/mqtt and <user_mqtt_id> is the MQTT hash of the basic user running the workflow which can be found from the REST API /v2/users or /v2/users/<login_id> endpoints.

  • Credit cost: 1
  • Parameters:
    • device: str|unicode Sub-division of topic to publish to.
    • update_type: str|unicode Sub-division of topic to publish to.
    • payload: str|unicode Data to publish.
    • encoding: str|unicode Encoding of payload. Supported encodings: utf-8, latin1
  • Returns: None



MQTT.publish_update_to_group

Usage: MQTT.publish_update_to_group(group_id, update_type, payload, encoding='utf-8')

Publishes the string payload encoded as encoding via the Renesas IoT Sandbox MQTT broker to the topic 2/<project_mqtt_id>/<group_id>/<update_type>, where <project_mqtt_id> is the project specific MQTT hash which can be found at https://app-renesas-na-sandbox.mediumone.com/#/admin/mqtt.

  • Credit cost: 1
  • Parameters:
    • group_id: str|unicode Sub-division of topic to publish to.
    • update_type: str|unicode Sub-division of topic to publish to.
    • payload: str|unicode Data to publish.
    • encoding: str|unicode Encoding of payload. Supported encodings: utf-8, latin1
  • Returns: None



Sample Code

import MQTT

if IONode.get_input('heartrate')['event_data']['value'] > 140:
    MQTT.publish_event_to_client('smart-watch', 'Heartrate is too high!')

Getting Started
User Roles & Permissions
Streams, Tags, & Data Types
Dashboard Widgets
API
Workflow Studio
Workflow Libraries
Metering
Special Characters
Third Party Integration
Mobile
API Explorer

MQTT Library

The MQTT Library functions provide access to publish/subscribe using MQTT protocol.

Import


To use this library and its functions, you must use the import line at the beginning of your Base Python code.

import MQTT


Functions


MQTT.publish_event_to_client

Usage: MQTT.publish_event_to_client(device, payload, encoding='utf-8')

Publishes the string payload encoded as encoding via the Renesas IoT Sandbox MQTT broker to the topic 1/<project_mqtt_id>/<user_mqtt_id>/<device>/event , where <project_mqtt_id> is the project specific MQTT hash which can be found at https://app-renesas-na-sandbox.mediumone.com/#/admin/mqtt and <user_mqtt_id> is the MQTT hash of the basic user running the workflow which can be found from the REST API /v2/users or /v2/users/<login_id> endpoints.

  • Credit cost: 1
  • Parameters:
    • device: str|unicode Sub-division of topic to publish to.
    • payload: str|unicode Data to publish.
    • encoding: str|unicode Encoding of payload. Supported encodings: utf-8, latin1
  • Returns: None



MQTT.publish_update_to_client

Usage: MQTT.publish_update_to_client(device, update_type, payload, encoding='utf-8')

Publishes the string payload encoded as encoding via the Renesas IoT Sandbox MQTT broker to the topic 1/<project_mqtt_id>/<user_mqtt_id>/<device>/update/<update_type> , where <project_mqtt_id> is the project specific MQTT hash which can be found at https://app-renesas-na-sandbox.mediumone.com/#/admin/mqtt and <user_mqtt_id> is the MQTT hash of the basic user running the workflow which can be found from the REST API /v2/users or /v2/users/<login_id> endpoints.

  • Credit cost: 1
  • Parameters:
    • device: str|unicode Sub-division of topic to publish to.
    • update_type: str|unicode Sub-division of topic to publish to.
    • payload: str|unicode Data to publish.
    • encoding: str|unicode Encoding of payload. Supported encodings: utf-8, latin1
  • Returns: None



MQTT.publish_update_to_group

Usage: MQTT.publish_update_to_group(group_id, update_type, payload, encoding='utf-8')

Publishes the string payload encoded as encoding via the Renesas IoT Sandbox MQTT broker to the topic 2/<project_mqtt_id>/<group_id>/<update_type>, where <project_mqtt_id> is the project specific MQTT hash which can be found at https://app-renesas-na-sandbox.mediumone.com/#/admin/mqtt.

  • Credit cost: 1
  • Parameters:
    • group_id: str|unicode Sub-division of topic to publish to.
    • update_type: str|unicode Sub-division of topic to publish to.
    • payload: str|unicode Data to publish.
    • encoding: str|unicode Encoding of payload. Supported encodings: utf-8, latin1
  • Returns: None



Sample Code

import MQTT

if IONode.get_input('heartrate')['event_data']['value'] > 140:
    MQTT.publish_event_to_client('smart-watch', 'Heartrate is too high!')