mirror of
https://github.com/openshwprojects/OpenBK7231T_App.git
synced 2026-02-05 04:55:33 +00:00
move out mqttopics to docs
This commit is contained in:
@ -14,5 +14,6 @@ Do not add anything here, as it will overwritten with next rebuild.
|
||||
| [Console/Script commands](https://github.com/openshwprojects/OpenBK7231T_App/blob/main/docs/commands.md) (237 total) | There are multiple console commands that allow you to automate your devices. Commands can be entered manually in command line, can be send by HTTP (just like in Tasmota), can be send by MQTT and also can be scripted. |
|
||||
| [Command Examples](https://github.com/openshwprojects/OpenBK7231T_App/blob/main/docs/commandExamples.md) (10 total) | Here you can find some examples of console commands usage |
|
||||
| [Autoexec.bat examples (configs)](https://github.com/openshwprojects/OpenBK7231T_App/blob/main/docs/autoexecExamples.md) (9 total) | Here you can find examples of autoexec.bat configs. The autoexec.bat file can be created in Web Application, under LittleFS tab, and is run every time device reboots (unless device enters safe mode/AP mode). The autoexec.bat file allows you to create more advanced configs, setup TuyaMCU mappings, etc |
|
||||
| [MQTT Topics](https://github.com/openshwprojects/OpenBK7231T_App/blob/main/docs/mqttTopics.md) (25 total) | MQTT topic names and content for incoming and ougoing OBK MQTT publishes |
|
||||
| [Script examples](https://github.com/openshwprojects/OpenBK7231T_App/blob/main/docs/scriptExamples.md) (5 total) | Scripts can be put in autoexec.bat and then they will start automatically on reboot, you can also put script in other LittleFS file and use startScript [fileName] [Label] command to run them. From the firmware point of view, scripts and autoexecs are basically the same thing. There is, however, a little bit more advanced system of execution for scripts which can be written in a form of scripts threads that run over time, can have delays within then, conditional checks and jumps. |
|
||||
| [Console/Script commands [Extended Edition]](https://github.com/openshwprojects/OpenBK7231T_App/blob/main/docs/commands-extended.md) (237 total) | More details on commands. |
|
||||
|
||||
@ -7,6 +7,7 @@
|
||||
"drivers": "Drivers allows you to control certain peripherals or enable certain features that are off by default.",
|
||||
"faq": "Here is a detailed list of questions you may ask. Some information from docs is repeated here.",
|
||||
"commandExamples":"Here you can find some examples of console commands usage",
|
||||
"mqttTopics":"MQTT topic names and content for incoming and ougoing OBK MQTT publishes",
|
||||
"autoexecExamples":"Here you can find examples of autoexec.bat configs. The autoexec.bat file can be created in Web Application, under LittleFS tab, and is run every time device reboots (unless device enters safe mode/AP mode). The autoexec.bat file allows you to create more advanced configs, setup TuyaMCU mappings, etc",
|
||||
"scriptExamples":"Scripts can be put in autoexec.bat and then they will start automatically on reboot, you can also put script in other LittleFS file and use startScript [fileName] [Label] command to run them. From the firmware point of view, scripts and autoexecs are basically the same thing. There is, however, a little bit more advanced system of execution for scripts which can be written in a form of scripts threads that run over time, can have delays within then, conditional checks and jumps."
|
||||
}
|
||||
131
docs/json/mqttTopics.json
Normal file
131
docs/json/mqttTopics.json
Normal file
@ -0,0 +1,131 @@
|
||||
{
|
||||
"publishes": [
|
||||
{
|
||||
"topic": "OBK_DEV_NAME/INDEX/get",
|
||||
"example": "1",
|
||||
"description": "send when a given channel is changed. INDEX is a number representing channel index. Some channels are not published by default, see flags. You can have any variable in channel, even a custom, fully scriptable counter"
|
||||
},
|
||||
{
|
||||
"topic": "OBK_DEV_NAME/connected",
|
||||
"example": "online",
|
||||
"description": "Sent on connect."
|
||||
},
|
||||
{
|
||||
"topic": "OBK_DEV_NAME/sockets",
|
||||
"example": "5",
|
||||
"description": "Send on connect and every N seconds (default: 60, if enabled)"
|
||||
},
|
||||
{
|
||||
"topic": "OBK_DEV_NAME/rssi",
|
||||
"example": "-70",
|
||||
"description": "Send on connect and every N seconds (default: 60, if enabled)"
|
||||
},
|
||||
{
|
||||
"topic": "OBK_DEV_NAME/uptime",
|
||||
"example": "653",
|
||||
"description": "Send on connect and every N seconds (default: 60, if enabled)"
|
||||
},
|
||||
{
|
||||
"topic": "OBK_DEV_NAME/freeheap",
|
||||
"example": "95168",
|
||||
"description": "Send on connect and every N seconds (default: 60, if enabled)"
|
||||
},
|
||||
{
|
||||
"topic": "OBK_DEV_NAME/ip",
|
||||
"example": "192.168.0.123",
|
||||
"description": "Send on connect and every N seconds (default: 60, if enabled)"
|
||||
},
|
||||
{
|
||||
"topic": "OBK_DEV_NAME/datetime",
|
||||
"example": "",
|
||||
"description": "Send on connect and every N seconds (default: 60, if enabled)"
|
||||
},
|
||||
{
|
||||
"topic": "OBK_DEV_NAME/mac",
|
||||
"example": "84:e3:42:65:d1:87 ",
|
||||
"description": "Send on connect and every N seconds (default: 60, if enabled)"
|
||||
},
|
||||
{
|
||||
"topic": "OBK_DEV_NAME/build",
|
||||
"example": "Build on Nov 12 2022 12:39:44 version 1.0.0",
|
||||
"description": "Send on connect and every N seconds (default: 60, if enabled)"
|
||||
},
|
||||
{
|
||||
"topic": "OBK_DEV_NAME/host",
|
||||
"example": "obk_t_fourRelays",
|
||||
"description": "Send on connect and every N seconds (default: 60, if enabled)"
|
||||
},
|
||||
{
|
||||
"topic": "OBK_DEV_NAME/voltage/get",
|
||||
"example": "221",
|
||||
"description": "Voltage from BL0942/BL0937 etc, just like current and power"
|
||||
},
|
||||
{
|
||||
"topic": "OBK_DEV_NAME/led_enableAll/get",
|
||||
"example": "1",
|
||||
"description": "Send when LED On/Off changes or when periodic broadcast is enabled"
|
||||
},
|
||||
{
|
||||
"topic": "OBK_DEV_NAME/led_basecolor_rgb/get",
|
||||
"example": "FFAABB",
|
||||
"description": "Send when LED color changes or when periodic broadcast is enabled."
|
||||
},
|
||||
{
|
||||
"topic": "OBK_DEV_NAME/led_dimmer/get",
|
||||
"example": "100",
|
||||
"description": "Send when LED dimmer changes or when periodic broadcast is enabled"
|
||||
},
|
||||
{
|
||||
"topic": "OBK_DEV_NAME/YOUR_TOPIC/get",
|
||||
"example": "YOUR_VALUE",
|
||||
"description": "You can publish anything with 'publish [YOUR_TOPIC] [YOUR_VALUE]' command"
|
||||
},
|
||||
{
|
||||
"topic": "tele/OBK_DEV_NAME/STATE",
|
||||
"example": "Tasmota JSON",
|
||||
"description": "OBK can publish Tasmota STATE style message if you enable TELE/etc publishes in options. This is used for compatibility with ioBroker, etc"
|
||||
},
|
||||
{
|
||||
"topic": "stat/OBK_DEV_NAME/RESULT",
|
||||
"example": "Tasmota JSON",
|
||||
"description": "See above. You can also see related self test code for details"
|
||||
},
|
||||
{
|
||||
"topic": "tele/OBK_DEV_NAME/SENSOR",
|
||||
"example": "{ \"Time\": \"1970-01-01T00:00:00\", \"ENERGY\": { \"Power\": 0, \"ApparentPower\": 0, \"ReactivePower\": 0, \"Factor\": 0, \"Voltage\": 249.932449, \"Current\": 0,\"ConsumptionTotal\": 255.346664,\"ConsumptionLastHour\": 0 }}",
|
||||
"description": "See above. Published by power metering devices, BL0937, BL0942, etc). Make sure NTP is running to get time."
|
||||
},
|
||||
{
|
||||
"topic": "[similiar tasmota messages]",
|
||||
"example": "Tasmota JSON",
|
||||
"description": "See above. See related self test code for details"
|
||||
},
|
||||
{
|
||||
"topic": "OBK_DEV_NAME/RESULT",
|
||||
"example": "{ \"IrReceived\": { \"Protocol\": \"Samsung\", \"Bits\": 32, \"Data\": \"0xEE110707\" } }",
|
||||
"description": "Sent if Tasmota syntax IR publish is enabled in flags. NOTE: we may fix it and add tele prefix soon?"
|
||||
}
|
||||
],
|
||||
"listens": [
|
||||
{
|
||||
"topic": "OBK_DEV_NAME/INDEX/set",
|
||||
"example": "1",
|
||||
"description": "Sets the channel of INDEX to given value. This can set relays and also provide DIRECT PWM access. If channel is mapped to TuyaMCU, TuyaMCU will also be updated"
|
||||
},
|
||||
{
|
||||
"topic": "cmnd/OBK_DEV_NAME/COMMAND_TEXT",
|
||||
"example": "COMMAND_ARGUMENTS",
|
||||
"description": "You can execute any command supported by OpenBeken, just like in Tasmota"
|
||||
},
|
||||
{
|
||||
"topic": "OBK_DEV_NAME/INDEX/get",
|
||||
"example": "no payload",
|
||||
"description": "You can send an empty 'get' publish to OBK device to request update on the state of given channel. OBK will reply back with the same topic but with payload representing given channel value."
|
||||
},
|
||||
{
|
||||
"topic": "OBK_DEV_NAME/VARIABLE/get",
|
||||
"example": "no payload",
|
||||
"description": "You can send an empty publish with VARIABLE=\"led_dimmer\"/\"led_enableAll\", etc etc, to query publish of given variable manually. OBK device will reply with publishing given variable."
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -671,6 +671,7 @@ let generic = readJSONFile("docs/json/generic.json");
|
||||
let commandExamples = readJSONFile("docs/json/commandExamples.json");
|
||||
let autoexecExamples = readJSONFile("docs/json/autoexecExamples.json");
|
||||
let scriptExamples = readJSONFile("docs/json/scriptExamples.json");
|
||||
let mqttTopics = readJSONFile("docs/json/mqttTopics.json");
|
||||
|
||||
for (let i = 0; i < scriptExamples.length; i++)
|
||||
{
|
||||
@ -780,6 +781,55 @@ Do not add anything here, as it will overwritten with next rebuild.
|
||||
|:------------- |:-------------:|:----- | ------:|
|
||||
`;
|
||||
|
||||
let mqttText =
|
||||
`# MQTT topics of published variables
|
||||
Some MQTT variables are being published only at the startup, some are published periodically (if you enable "broadcast every N seconds" flag, default time is one minute, customizable with command mqtt_broadcastInterval), some are published only when a given value is changed. Below is the table of used publish topics (TODO: add full descriptions)
|
||||
|
||||
Hint: in HA, you can use MQTT wildcard to listen to multiple publishes. OBK_DEV_NAME/#
|
||||
|
||||
Publishes send by OBK device:
|
||||
| Topic | Sample Value | Description |
|
||||
|:------------- |:------------- | -----:|
|
||||
`;
|
||||
|
||||
for (let i = 0; i < mqttTopics.publishes.length; i++){
|
||||
|
||||
|
||||
let pub = mqttTopics.publishes[i];
|
||||
|
||||
let textshort = `| ${pub.topic} | ${pub.example} | ${pub.description} |`;
|
||||
|
||||
// allow multi-row entries in table entries.
|
||||
textshort = textshort.replace(/\n/g, '<br/>');
|
||||
|
||||
mqttText += textshort;
|
||||
mqttText += '\n';
|
||||
}
|
||||
|
||||
mqttText +=
|
||||
`
|
||||
|
||||
Publishes received by OBK device:
|
||||
| Topic | Sample Value | Description |
|
||||
|:------------- |:------------- | -----:|
|
||||
`;
|
||||
let publishes_and_listens = mqttTopics.listens.concat(mqttTopics.publishes);
|
||||
for (let i = 0; i < mqttTopics.listens.length; i++){
|
||||
|
||||
|
||||
let pub = mqttTopics.listens[i];
|
||||
|
||||
let textshort = `| ${pub.topic} | ${pub.example} | ${pub.description} |`;
|
||||
|
||||
// allow multi-row entries in table entries.
|
||||
textshort = textshort.replace(/\n/g, '<br/>');
|
||||
|
||||
mqttText += textshort;
|
||||
mqttText += '\n';
|
||||
}
|
||||
|
||||
|
||||
|
||||
for (let i = 0; i < flags.length; i++) {
|
||||
|
||||
|
||||
@ -1009,6 +1059,7 @@ writeDocMD('faq', faqmdshort, faq, "FAQ", false, generic.faq);
|
||||
writeDocMD('commands', mdshort, commands, "Console/Script commands", true, generic.commands);
|
||||
writeDocMD('commandExamples', commandExamplesmdshort, commandExamples, "Command Examples", false, generic.commandExamples);
|
||||
writeDocMD('autoexecExamples', autoexecsmdshort, autoexecExamples, "Autoexec.bat examples (configs)", false, generic.autoexecExamples);
|
||||
writeDocMD('mqttTopics', mqttText, publishes_and_listens, "MQTT Topics", false, generic.mqttTopics);
|
||||
writeDocMD('scriptExamples', scriptsmdshort, scriptExamples, "Script examples", false, generic.scriptExamples);
|
||||
writeDocMD('commands-extended', mdlong, commands, "Console/Script commands [Extended Edition]", false, "More details on commands.")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user