diff --git a/docs/README.md b/docs/README.md index 7b498be6c..0cf2c98e4 100644 --- a/docs/README.md +++ b/docs/README.md @@ -10,9 +10,9 @@ Do not add anything here, as it will overwritten with next rebuild. | [Drivers](https://github.com/openshwprojects/OpenBK7231T_App/blob/main/docs/drivers.md) (28 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) (18 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) (35 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.
Some channels have '_div10' or '_div100' sufixes. 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) (22 total) | Here is a detailed list of questions you may ask. Some information from docs is repeated here. | +| [FAQ](https://github.com/openshwprojects/OpenBK7231T_App/blob/main/docs/faq.md) (23 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) (228 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) (6 total) | Here you can find some examples of console commands usage | +| [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) (7 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 | | [Script examples](https://github.com/openshwprojects/OpenBK7231T_App/blob/main/docs/scriptExamples.md) (4 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 advananced 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) (228 total) | More details on commands. | diff --git a/docs/commandExamples.md b/docs/commandExamples.md index fa24da082..c03eb743d 100644 --- a/docs/commandExamples.md +++ b/docs/commandExamples.md @@ -27,6 +27,26 @@ This will create a new repeating events with 1 repeat count and 60 seconds delay +This is another approach to sending GET for change. As you can see, it's using addEventHandler instead of addChangeHandler. This will fire with every change. The index 1 here is a channel index. The $CH1 macro in URL will get expended to current channel value, usually 1 or 0 +
```addEventHandler OnChannelChange 1 http://192.168.0.112/cm?cmnd=Power0%20$CH1```
+ + + +This will execute console command when IR event is received. Keep in mind it's using addEventHandler2, which is like addEventHandler, but takes two arguments. +
```addEventHandler2 IR_Samsung 0x707 0x61 led_enableAll 0```
+ + + +This will turn on LED with 500 temperature 500, dimmer 100 at 8:00:00 every Sunday (0x01 is a bit flag for Sunday, bit 0 means sunday, bit 1 monday, etc etc), 234 here is unique ID of clock event so you can remove it later. You MUST START NTP driver for it to work. +
```addClockEvent 8:00:00 0x01 234 backlog led_temperature 500; led_dimmer 100; led_enableAll 1;```
+ + + +This will turn on POWER at 12:00:00 every Sunday and Monday (0x01 is a bit flag for Sunday, bit 0 means sunday, bit 1 monday, etc etc), 567 here is unique ID of clock event so you can remove it later. You MUST START NTP driver for it to work. +
```addClockEvent 12:00:00 0x03 567 POWER ON```
+ + + This simple timer will toggle LED state every 5 seconds. -1 hear means infinite repeats. The ! stands for negation and $led_enableAll is a constant that you can read to get 0 or 1. It works like $CH11, $CH4 etc (any number) for accessing channel value
```addRepeatingEvent 5 -1 led_enableAll !$led_enableAll```
diff --git a/docs/faq.md b/docs/faq.md index c97d8c82b..8e7f6e054 100644 --- a/docs/faq.md +++ b/docs/faq.md @@ -15,6 +15,9 @@ All questions/answers were taken from json file. **Question:** *How do I enable more logging? How to make more logs visible?*
**A:** First type 'loglevel x' in console, where x is 0 to 7, default value is 3 (log all up to info), value 4 will also log debug logs, and value 5 will include 'extradebug'. Then, on online panel, also switch filter to 'All' (both steps must be done for logs to show up) +**Question:** *How to change baud rate for TuyaMCU?*
**A:** Just search for 'baud' in our commands list. The command is tuyaMcu_setBaudRate. Remember that it must be run after you do startDriver TuyaMCU. The baud setting is not kept after reboot, so put that command in autoexec.bat + + **Question:** *How to make device discoverable by Windows?*
**A:** OpenBeken devices will show up in Windows Network if you run SSDP driver. This driver must be run at each startup. You could just do 'startDriver SSDP' in console but that will not run again after reboot, so either use Short Startup Command or autoexec.bat to run that command with each reboot diff --git a/docs/json/commandExamples.json b/docs/json/commandExamples.json index a939b5b91..d3511d86c 100644 --- a/docs/json/commandExamples.json +++ b/docs/json/commandExamples.json @@ -20,6 +20,22 @@ "description": "This will create a new repeating events with 1 repeat count and 60 seconds delay everytime Channel1 becomes 1. Basically, it will automatically turn off the light 60 seconds after you turn it on. TODO: clear previous event instance?" }, { +"command": "addEventHandler OnChannelChange 1 http://192.168.0.112/cm?cmnd=Power0%20$CH1", +"description": "This is another approach to sending GET for change. As you can see, it's using addEventHandler instead of addChangeHandler. This will fire with every change. The index 1 here is a channel index. The $CH1 macro in URL will get expended to current channel value, usually 1 or 0" +}, +{ +"command": "addEventHandler2 IR_Samsung 0x707 0x61 led_enableAll 0", +"description": "This will execute console command when IR event is received. Keep in mind it's using addEventHandler2, which is like addEventHandler, but takes two arguments." +}, +{ +"command": "addClockEvent 8:00:00 0x01 234 backlog led_temperature 500; led_dimmer 100; led_enableAll 1;", +"description": "This will turn on LED with 500 temperature 500, dimmer 100 at 8:00:00 every Sunday (0x01 is a bit flag for Sunday, bit 0 means sunday, bit 1 monday, etc etc), 234 here is unique ID of clock event so you can remove it later. You MUST START NTP driver for it to work." +}, +{ +"command": "addClockEvent 12:00:00 0x03 567 POWER ON", +"description": "This will turn on POWER at 12:00:00 every Sunday and Monday (0x01 is a bit flag for Sunday, bit 0 means sunday, bit 1 monday, etc etc), 567 here is unique ID of clock event so you can remove it later. You MUST START NTP driver for it to work." +}, +{ "command": "addRepeatingEvent 5 -1 led_enableAll !$led_enableAll", "description": "This simple timer will toggle LED state every 5 seconds. -1 hear means infinite repeats. The ! stands for negation and $led_enableAll is a constant that you can read to get 0 or 1. It works like $CH11, $CH4 etc (any number) for accessing channel value" } diff --git a/docs/json/faq.json b/docs/json/faq.json index 0caced491..0b47c4958 100644 --- a/docs/json/faq.json +++ b/docs/json/faq.json @@ -15,6 +15,10 @@ "question": "How do I enable more logging? How to make more logs visible?", "answer": "First type 'loglevel x' in console, where x is 0 to 7, default value is 3 (log all up to info), value 4 will also log debug logs, and value 5 will include 'extradebug'. Then, on online panel, also switch filter to 'All' (both steps must be done for logs to show up)" }, + { + "question": "How to change baud rate for TuyaMCU?", + "answer": "Just search for 'baud' in our commands list. The command is tuyaMcu_setBaudRate. Remember that it must be run after you do startDriver TuyaMCU. The baud setting is not kept after reboot, so put that command in autoexec.bat" + }, { "question": "How to make device discoverable by Windows?", "answer": "OpenBeken devices will show up in Windows Network if you run SSDP driver. This driver must be run at each startup. You could just do 'startDriver SSDP' in console but that will not run again after reboot, so either use Short Startup Command or autoexec.bat to run that command with each reboot"