MQTT Integration
The MQTT function within folotoy server allows useful values to be published to an MQTT broker or subscribe to the topic to modify the configuration of folotoy server. This is useful in allowing other automation platforms to consume data from folotoy server or talk with.
MQTT Topics
Before using the MQTT integration feature, you need to set INTEGRATION_MQTT
to true
. Please refer to the environment variable settings for more information.
The following are the available topics and permission descriptions.
Topic | Permissions | Description | Payload |
---|---|---|---|
/sys/folotoy/$sn/thing/event/post | Subscribe | Send event message about toys. identifier: voice_generated,recording_transcribed | {"msgId": 174, "identifier": "voice_generated", "inputParams": {"recordingId": 31, "order": 4, "voiceText": " What's your first question?", "voiceUrl": "http://192.168.52.164:8082/voice-58fa4289fcc04d89bfee38aa038a904a.mp3", "role": 7}} |
/sys/folotoy/$sn/thing/command/call | Publish | Send command message to toys. identifier: iwantplay,identifier: updatecommonconfig | Play text using role 1: {"msgId": 100,"identifier": "iwantplay","inputParams": {"role": 1,"text": "This is a test of playing text to speech 123 hi good friends"}} Play url: {"msgId" : 1, "identifier" : "iwantplay", "inputParams" : { "url" : "http://192.168.52.81:9001/speech-11.mp3" }} When both URL and text exist, prioritize playing URL change common config: {"msgId" : 1, "identifier" : "updatecommonconfig", "inputParams" : { "record_type" : 1,"open_tip_type" : 1,"voltage_alarm" : 3.7,"sleep_trigger_time" : 600,"volume" : 100,"volume_control_type" : 1 }} record_type: 1-click record button to record,2-press record button to record,3-continuous conversation mode open_tip_type: 0-disable open tip sound,1-enable open tip sound voltage_alarm: voltage warning value configuration, default to 3.7V sleep_trigger_time: sleep trigger time configuration, default to 0, minimum to 30, unit in seconds, not enabled when 0 volume: volume configuration, default to 100, range from 0 to 100 currently volume_control_type: Volume setting type configuration; 1. Knob control, 2. Command control, default to 1 |
/sys/folotoy/+/thing/command/callAck | Subscribe | Subscribe command execution message from toys. identifier: iwantplay | {"identifier": "iwantplay", "msgId": 1, "result": 1}, If result is 0 when command failed |
/sys/config | Publish | Online modification of system configuration, identifier includes: load_roles_config. If the message sent contains msgId, the reply message will also contain msgId. | {"msgId": 174, "identifier": "load_roles_config"} |
/sys/configAck | Subscribe | Reply to online modification of system configuration. | {"msgId": 174, "identifier": "load_roles_config", "result": 1} |
note
$sn
usually can be found at your Toy case or in the console of tool.folotoy.com