Skip to content

Commit

Permalink
docs
Browse files Browse the repository at this point in the history
  • Loading branch information
openshwprojects committed Oct 10, 2024
1 parent 9415b4f commit b2bc6af
Show file tree
Hide file tree
Showing 9 changed files with 125 additions and 23 deletions.
4 changes: 2 additions & 2 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ Do not add anything here, as it will overwritten with next rebuild.
| Section | Comment |
|:------------- |------:|
| [IO/Pin Roles](https://github.com/openshwprojects/OpenBK7231T_App/blob/main/docs/ioRoles.md) (80 total) | You can set pin roles in 'Configure Module' section or use one of predefined templates in Web App. For each pin, you also set corresponding channel value. This is needed for modules with multiple relays. If you have 3 relays and 3 buttons, you need to use channel values like 1, 2, and 3. Just enter '1' in the text field, etc. |
| [Flags](https://github.com/openshwprojects/OpenBK7231T_App/blob/main/docs/flags.md) (50 total) | Flags are global and allows you to alter behaviour of the device. |
| [Flags](https://github.com/openshwprojects/OpenBK7231T_App/blob/main/docs/flags.md) (51 total) | Flags are global and allows you to alter behaviour of the device. |
| [Drivers](https://github.com/openshwprojects/OpenBK7231T_App/blob/main/docs/drivers.md) (59 total) | Drivers allows you to control certain peripherals or enable certain features that are off by default. |
| [Script constants](https://github.com/openshwprojects/OpenBK7231T_App/blob/main/docs/constants.md) (40 total) | Every console command that takes an integer argument supports certain constant expansion. |
| [Channel Types](https://github.com/openshwprojects/OpenBK7231T_App/blob/main/docs/channelTypes.md) (59 total) | Channel types are often not required and don't have to be configured, but in some cases they are required for better device control from OpenBeken web panel. Channel types describes the kind of value stored in channel, for example, if you have a Tuya Fan Controller with 3 speeds control, you can set the channel type to LowMidHigh and it will display the correct UI radiobutton on OpenBeken panel.<br>Some channels have '_div10' or '_div100' suffixes. This is for TuyaMCU. This is needed because TuyaMCU sends values as integers, so it sends, for example, 215 for 21.5C temperature, and we store it internally as 215 and only convert to float for display. |
| [FAQ](https://github.com/openshwprojects/OpenBK7231T_App/blob/main/docs/faq.md) (31 total) | Here is a detailed list of questions you may ask. Some information from docs is repeated here. |
| [Console/Script commands](https://github.com/openshwprojects/OpenBK7231T_App/blob/main/docs/commands.md) (314 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) (36 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 |
| [Autoexec.bat examples (configs)](https://github.com/openshwprojects/OpenBK7231T_App/blob/main/docs/autoexecExamples.md) (37 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 outgoing OBK MQTT publishes |
| [Script examples](https://github.com/openshwprojects/OpenBK7231T_App/blob/main/docs/scriptExamples.md) (6 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) (314 total) | More details on commands. |
94 changes: 94 additions & 0 deletions docs/autoexecExamples.md
Original file line number Diff line number Diff line change
Expand Up @@ -1261,3 +1261,97 @@ addEventHandler OnChannelChange 4 myset
```


[Scripting custom light animation/styles for TuyaMCU](https://www.elektroda.com/rtvforum/topic4014389.html)
<br>
```
// See: https://www.elektroda.com/rtvforum/topic4014389.html
startDriver httpButtons
setButtonEnabled 0 1
setButtonLabel 0 "Music mode"
setButtonCommand 0 "tuyaMcu_sendState 21 4 3"
setButtonEnabled 1 1
setButtonLabel 1 "Light mode"
setButtonCommand 1 "tuyaMcu_sendState 21 4 1"
setButtonEnabled 2 1
setButtonLabel 2 "Curtain"
setButtonCommand 2 "startScript autoexec.bat do_cur"
setButtonEnabled 3 1
setButtonLabel 3 "Collision"
setButtonCommand 3 "startScript autoexec.bat do_col"
setButtonEnabled 4 1
setButtonLabel 4 "Rainbow"
setButtonCommand 4 "startScript autoexec.bat do_rai"
setButtonEnabled 5 1
setButtonLabel 5 "Pile"
setButtonCommand 5 "startScript autoexec.bat do_pil"
setButtonEnabled 6 1
setButtonLabel 6 "Firework"
setButtonCommand 6 "startScript autoexec.bat do_fir"
setButtonEnabled 7 1
setButtonLabel 7 "Chase"
setButtonCommand 7 "startScript autoexec.bat do_chase"
// startDriver MCP9808 [ClkPin] [DatPin] [OptionalTargetChannel]
startDriver MCP9808 7 8 1
MCP9808_Adr 0x30
MCP9808_Cycle 1
// use choice to choose effect by index stored in $CH10
alias do_chosen_effect Choice $CH10 cmd_cur cmd_col cmd_rai cmd_pil cmd_fir cmd_chase
// when click on Btn_ScriptOnly on P24 happens, add 1 to $CH10 (wrap to 0-5) and do effect
addEventHandler OnClick 24 backlog addChannel 10 1 0 4 1; do_chosen_effect
// stop execution
return
do_chase:
tuyaMcu_sendState 21 4 2
delay_s 0.1
tuyaMcu_sendState 25 3 020e0d00001403e803e800000000
return
do_cur:
tuyaMcu_sendState 21 4 2
delay_s 0.1
tuyaMcu_sendState 25 3 000e0d00002e03e802cc00000000
return
do_col:
tuyaMcu_sendState 21 4 2
delay_s 0.1
tuyaMcu_sendState 25 3 07464602000003e803e800000000464602007803e803e80000000046460200f003e803e800000000464602003d03e803e80000000046460200ae03e803e800000000464602011303e803e800000000
return
do_rai:
tuyaMcu_sendState 21 4 2
delay_s 0.1
tuyaMcu_sendState 25 3 06464601000003e803e800000000464601007803e803e80000000046460100f003e803e800000000
return
do_pil:
tuyaMcu_sendState 21 4 2
delay_s 0.1
tuyaMcu_sendState 25 3 010e0d000084000003e800000000
return
do_fir:
tuyaMcu_sendState 21 4 2
delay_s 0.1
tuyaMcu_sendState 25 3 05464601000003e803e800000000464601007803e803e80000000046460100f003e803e800000000464601003d03e803e80000000046460100ae03e803e800000000464601011303e803e800000000
return
```


12 changes: 6 additions & 6 deletions docs/commands-extended.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@ Do not add anything here, as it will overwritten with next rebuild.
| BridgePulseLength | [FloatValue] | Setup value for bridge pulse len.<br/><br/>See also [BridgePulseLength on forum](https://www.elektroda.com/rtvforum/find.php?q=BridgePulseLength). | File: driver/drv_bridge_driver.c<br/>Function: Bridge_Pulse_length |
| cancelRepeatingEvent | [UserIDInteger] | Stops a given repeating event with a specified ID.<br/><br/>See also [cancelRepeatingEvent on forum](https://www.elektroda.com/rtvforum/find.php?q=cancelRepeatingEvent). | File: cmnds/cmd_repeatingEvents.c<br/>Function: RepeatingEvents_Cmd_CancelRepeatingEvent |
| Ch | [InputValue] | An alternate command to access channels. It returns all used channels in JSON format. The syntax is ChINDEX value, there is no space between Ch and channel index. It can be sent without value to poll channel values.<br/><br/>See also [Ch on forum](https://www.elektroda.com/rtvforum/find.php?q=Ch). | File: cmnds/cmd_channels.c<br/>Function: CMD_Ch |
| chart_add | | See [tutorial](https://www.elektroda.com/rtvforum/topic4075289.html).<br/><br/>See also [chart_add on forum](https://www.elektroda.com/rtvforum/find.php?q=chart_add). | File: driver/drv_charts.c<br/>Function: NULL); |
| chart_addNow | | See [tutorial](https://www.elektroda.com/rtvforum/topic4075289.html).<br/><br/>See also [chart_addNow on forum](https://www.elektroda.com/rtvforum/find.php?q=chart_addNow). | File: driver/drv_charts.c<br/>Function: NULL); |
| chart_create | | See [tutorial](https://www.elektroda.com/rtvforum/topic4075289.html).<br/><br/>See also [chart_create on forum](https://www.elektroda.com/rtvforum/find.php?q=chart_create). | File: driver/drv_charts.c<br/>Function: NULL); |
| chart_setAxis | | See [tutorial](https://www.elektroda.com/rtvforum/topic4075289.html).<br/><br/>See also [chart_setAxis on forum](https://www.elektroda.com/rtvforum/find.php?q=chart_setAxis). | File: driver/drv_charts.c<br/>Function: NULL); |
| chart_setVar | | See [tutorial](https://www.elektroda.com/rtvforum/topic4075289.html).<br/><br/>See also [chart_setVar on forum](https://www.elektroda.com/rtvforum/find.php?q=chart_setVar). | File: driver/drv_charts.c<br/>Function: NULL); |
| chart_add | | Adds data to the chart with specified variables at a specific NTP time. See [tutorial](https://www.elektroda.com/rtvforum/topic4075289.html).<br/><br/>See also [chart_add on forum](https://www.elektroda.com/rtvforum/find.php?q=chart_add). | File: driver/drv_charts.c<br/>Function: NULL); |
| chart_addNow | | Adds data to the chart using the current NTP time. See [tutorial](https://www.elektroda.com/rtvforum/topic4075289.html).<br/><br/>See also [chart_addNow on forum](https://www.elektroda.com/rtvforum/find.php?q=chart_addNow). | File: driver/drv_charts.c<br/>Function: NULL); |
| chart_create | | Creates a chart with a specified number of samples, variables, and axes. See [tutorial](https://www.elektroda.com/rtvforum/topic4075289.html).<br/><br/>See also [chart_create on forum](https://www.elektroda.com/rtvforum/find.php?q=chart_create). | File: driver/drv_charts.c<br/>Function: NULL); |
| chart_setAxis | | Sets up an axis with a name, flags, and label. Currently flags can be 0 (left axis) or 1 (right axis). See [tutorial](https://www.elektroda.com/rtvforum/topic4075289.html).<br/><br/>See also [chart_setAxis on forum](https://www.elektroda.com/rtvforum/find.php?q=chart_setAxis). | File: driver/drv_charts.c<br/>Function: NULL); |
| chart_setVar | | Associates a variable with a specific axis. See [tutorial](https://www.elektroda.com/rtvforum/topic4075289.html).<br/><br/>See also [chart_setVar on forum](https://www.elektroda.com/rtvforum/find.php?q=chart_setVar). | File: driver/drv_charts.c<br/>Function: NULL); |
| Choice | [IndexToExecute][Option0][Option1][Option2][OptionN][etc] | This will choose a given argument by index and execute it as a command. Index to execute can be a variable like $CH1.<br/><br/>See also [Choice on forum](https://www.elektroda.com/rtvforum/find.php?q=Choice). | File: cmnds/cmd_main.c<br/>Function: NULL); |
| chSetupLimit | [limitChannelIndex] [maxAllowedLimitChannelDelta] [timeoutOr-1] [commandToRun] | After executing this command, chargingLimit driver will watch channel for changes and count down timer. When a timer runs our or channel change (from the initial state) is larger than given margin, given command is run.<br/><br/>See also [chSetupLimit on forum](https://www.elektroda.com/rtvforum/find.php?q=chSetupLimit). | File: driver/drv_chargingLimit.c<br/>Function: ChargingLimit_SetupCommand); |
| CHT_Alert | [TempDiff][HumDiff][Freq][FQ] | Enable alert pin. TempDif (temperature difference is any float higher than 0.05�C) = set detected difference in temperature required for device to wake. HumDiff (humidity difference is any float higher than 0.1%). Freq (time per measurement in s) = 1, 5, 10, 60, 120 (default if wrong = 1). FQ (fault queue number) = 1, 2, 4, 6 (default if wrong = 1).<br/><br/>Example: CHT_Alert 0.5 0 5 2 <br /> alert pin will trigger when temperature deviates by more than 0.5�C. Humidity will be ignored. Sensor measures every 5s with fault queue number 2.<br/><br/>See also [CHT_Alert on forum](https://www.elektroda.com/rtvforum/find.php?q=CHT_Alert). | File: drv/drv_cht8305.c<br/>Function: CHT_Alert |
Expand Down Expand Up @@ -296,7 +296,7 @@ Do not add anything here, as it will overwritten with next rebuild.
| TS_Clear | | Clears the text scroller buffer.<br/><br/>See also [TS_Clear on forum](https://www.elektroda.com/rtvforum/find.php?q=TS_Clear). | File: driver/drv_textScroller.c<br/>Function: NULL); |
| TS_Print | [StartOfs] [MaxLenOr0] [StringText] [optionalBClampWithZeroesForClock] | Prints a text to the text scroller buffer.<br/><br/>See also [TS_Print on forum](https://www.elektroda.com/rtvforum/find.php?q=TS_Print). | File: driver/drv_textScroller.c<br/>Function: NULL); |
| tuyaMcu_defWiFiState | | Command sets the default WiFi state for TuyaMCU when device is not online. It may be required for some devices to work, because Tuya designs them to ignore touch buttons or beep when not paired. Please see [values table and description here](https://www.elektroda.com/rtvforum/viewtopic.php?p=20483899#20483899).<br/><br/>See also [tuyaMcu_defWiFiState on forum](https://www.elektroda.com/rtvforum/find.php?q=tuyaMcu_defWiFiState). | File: driver/drv_tuyaMCU.c<br/>Function: Cmd_TuyaMCU_Send_RSSI |
| tuyaMcu_sendCmd | TuyaMCU_SendUserCmd | .<br/><br/>See also [tuyaMcu_sendCmd on forum](https://www.elektroda.com/rtvforum/find.php?q=tuyaMcu_sendCmd). | File: driver/drv_tuyaMCU.c<br/>Function: NULL); |
| tuyaMcu_sendCmd | [CommandIndex] [HexPayloadNBytes] | This will automatically calculate TuyaMCU checksum and length for given command ID and payload, then it will send a command. It's better to use it than uartSendHex.<br/><br/>See also [tuyaMcu_sendCmd on forum](https://www.elektroda.com/rtvforum/find.php?q=tuyaMcu_sendCmd). | File: driver/drv_tuyaMCU.c<br/>Function: NULL); |
| tuyaMcu_sendColor | [dpID] [red01] [green01] [blue01] [tuyaRGBformat] | This sends a TuyaMCU color string of given format for given RGB values, where each value is in [0,1] range as float.<br/><br/>See also [tuyaMcu_sendColor on forum](https://www.elektroda.com/rtvforum/find.php?q=tuyaMcu_sendColor). | File: driver/drv_tuyaMCU.c<br/>Function: NULL); |
| tuyaMcu_sendCurTime | | Sends a current date by TuyaMCU to clock/callendar MCU. Time is taken from NTP driver, so NTP also should be already running.<br/><br/>See also [tuyaMcu_sendCurTime on forum](https://www.elektroda.com/rtvforum/find.php?q=tuyaMcu_sendCurTime). | File: driver/drv_tuyaMCU.c<br/>Function: TuyaMCU_Send_SetTime_Current |
| tuyaMcu_sendHeartbeat | | Send heartbeat to TuyaMCU.<br/><br/>See also [tuyaMcu_sendHeartbeat on forum](https://www.elektroda.com/rtvforum/find.php?q=tuyaMcu_sendHeartbeat). | File: driver/drv_tuyaMCU.c<br/>Function: TuyaMCU_SendHeartbeat |
Expand Down
Loading

0 comments on commit b2bc6af

Please sign in to comment.