Add mqtt docs

This commit is contained in:
Alexander 2024-02-16 20:49:03 +01:00
parent 8ab59cf051
commit 6613fda4f2
3 changed files with 274 additions and 4 deletions

270
docs/MQTT_API.md Normal file
View file

@ -0,0 +1,270 @@
# MQTT
## About
MQTT is a machine-to-machine (M2M)/"Internet of Things" connectivity protocol. It was designed as an extremely lightweight publish/subscribe messaging transport. It is useful for connections with remote locations where a small code footprint is required and/or network bandwidth is at a premium.
## MQTT API
To be able to send MQTT commands to the device, you need to connect and use the following topic:
(All commands will need to be sent here)
```
anycubic/anycubicCloud/v1/server/printer/20023/<PRINTER_ID>/response
```
You can find the printer id by taking the first 32 characters of the file:
```
/user/ac_mqtt_connect_info
```
Then to see received responses from the printer, you need to subscribe to the following topic:
```
anycubic/anycubicCloud/v1/printer/public/#
```
### Commands
#### List internal files
```json
{
"type": "file",
"action": "listLocal",
"data": {
"path": "/"
}
}
```
#### List files on USB
```json
{
"type": "file",
"action": "listUdisk",
"data": {
"path": "/"
}
}
```
#### Delete internal file
```json
{
"type": "file",
"action": "deleteLocal",
"data": {
"path": "dir",
"filename": "filename"
}
}
```
#### Delete file on USB
```json
{
"type": "file",
"action": "deleteUdisk",
"data": {
"path": "dir",
"filename": "filename"
}
}
```
#### cloudRecommendList
Need more info on what this does
```json
{
"type": "cloudRecommendList",
"records" {
"md5": "md5",
"url": "url",
"size": "size",
"img_url": "img_url",
"est_time": "est_time",
}
}
```
#### Get printer status
```json
{
"type": "status",
"action": "query"
}
```
#### Video
```json
{
"type": "video",
"action": "startCapture",
"data": {
"region": "region",
"tmpSecretKey": "tmpSecret",
"tmpSecretId": "tmpSecretId",
"sessionToken": "sessionToken"
}
}
```
#### Get slice params
```json
{
"type": "print",
"action": "getSliceParam"
}
```
#### Get printer status
```json
{
"type": "print",
"action": "query"
}
```
#### localtasktrans
```json
{
"type": "print",
"action": "localtasktrans",
"data": {
"taskid": "<taskid>",
"localtask": "<localtask>"
}
}
```
#### Start print
```json
{
"type": "print",
"action": "start",
"data": {
"taskid": "<taskid>",
"url": "<url>",
"filename": "<filename>",
"filesize": "<filesize>",
"md5": "<md5>",
"filetype": "<filetype>",
"filepath": "<filepath>",
"project_type": "<project_type>"
}
}
```
#### Pause print
```json
{
"type": "print",
"action": "pause",
"data": {
"taskid": "<taskid>"
}
}
```
#### Resume print
```json
{
"type": "print",
"action": "resume",
"data": {
"taskid": "<taskid>"
}
}
```
#### Stop print
```json
{
"type": "print",
"action": "stop",
"data": {
"taskid": "<taskid>"
}
}
```
#### Update print
```json
{
"type": "print",
"action": "update",
"data": {
"taskid": "<taskid>",
"settings": {
"target_nozzle_temp": "<target_nozzle_temp>",
"target_hotbed_temp": "<target_hotbed_temp>",
"fan_speed_pct": "<fan_speed_pct>",
"print_speed_mode": "<print_speed_mode>",
"z_comp": "<z_comp>"
}
}
}
```
#### Cancel print
```json
{
"type": "print",
"action": "cancel",
"data": {
"taskid": "<taskid>"
}
}
```
#### Get ota version
```json
{
"type": "ota",
"action": "reportVersion",
"data": {
"force_update": "force_update",
"firmware_md5": "firmware_md5",
"firmware_version": "firmware_version",
"firmware_name": "firmware_name",
"firmware_url": "firmware_url",
"firmware_size": "firmware_size"
}
}
```
#### Update ota version
```json
{
"type": "ota",
"action": "update",
"data": {
"force_update": "force_update",
"firmware_md5": "firmware_md5",
"firmware_version": "firmware_version",
"firmware_name": "firmware_name",
"firmware_url": "firmware_url",
"firmware_size": "firmware_size"
}
}
```

View file

@ -5,7 +5,7 @@
# Disable patching an option by using '#' or ';' as a first caracter in the option line
# Use single or double quotes for the option value. Do not use spaces inside the quotes.
# Use list of values separated by a space if needed because suplicated option are not supported
# In square brackets you may place the name(s) of other option(s) required by a given option.
# In square brackets you may place the name(s) of other option(s) required by a given option.
# This will not auto include the required option(s) but will be used to validate the option integrity.
#-------------------------------------------------------------------------------------------------
@ -30,7 +30,7 @@ uart="2.3.9"
#ssh="dropbear"
# Enable opkg (+5MB to the update, +10MB to the rootfs)
#opkg="default"
opkg="default"
# Enable Python 3 (+14MB to the update, +25MB to the rootfs)
python="3.11"
@ -50,7 +50,7 @@ webcam="default" [python] [fswebcam]
# Replace the URL below with the URL of your MQTT server
# You also need to transfer to the printer your keys in
# the /user folder by ssh as explained in the project page
#kobra_unleashed="localhost.mr-a.de"
kobra_unleashed="localhost.mr-a.de"
# Replace some of the app images
#app_images="set1"
@ -59,4 +59,4 @@ webcam="default" [python] [fswebcam]
#boot_resource="kangaroo"
# Add a startup script
#startup_script="startup.sh"
startup_script="startup.sh"

0
temp/.gitkeep Normal file
View file