Skip to content

Commit

Permalink
docs refresh, add Deep sleep usage with SHT30 sensor and data reporti…
Browse files Browse the repository at this point in the history
…ng via HTTP GET
  • Loading branch information
openshwprojects committed Sep 24, 2023
1 parent 735236a commit 92cbb9c
Show file tree
Hide file tree
Showing 6 changed files with 71 additions and 2 deletions.
4 changes: 2 additions & 2 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ Do not add anything here, as it will overwritten with next rebuild.
| [Flags](https://github.com/openshwprojects/OpenBK7231T_App/blob/main/docs/flags.md) (43 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) (41 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) (29 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) (42 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' 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. |
| [Channel Types](https://github.com/openshwprojects/OpenBK7231T_App/blob/main/docs/channelTypes.md) (43 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' 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) (30 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) (280 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) (18 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) (19 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) (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) (280 total) | More details on commands. |
31 changes: 31 additions & 0 deletions docs/autoexecExamples.md
Original file line number Diff line number Diff line change
Expand Up @@ -502,3 +502,34 @@ addI2CDevice_TC74 Soft 0x4D 6
```


Deep sleep usage with SHT30 sensor and data reporting via HTTP GET
<br>
```// source: https://www.elektroda.com/rtvforum/viewtopic.php?p=20693161#20693161
// NOTE: SHT3X is configured to store temp in channel2 and humidity in channel 3
// start driver
startDriver SHT3X
//hold button for 3 seconds to get into safe mode
addEventHandler OnHold 20 SafeMode 3
// wait for wifi to become WIFI_STA_CONNECTED
waitFor WiFiState 4
Battery_Setup 2500 4200 2.29 2400 4096
battery_measure
publishFloat "voltage" $CH4/1000
//publishFloat "battery" $CH4/25
// extra wait
delay_s 5
// measure
SHT_Measure
// send data
SendGET http://address:port/sensor1.php?temp=$CH2&hum=$CH3&bat=$voltage
// wait for GET to be sent
delay_s 5
// sleep for 120 seconds and then wake up (from blank state)
DeepSleep 120
```


25 changes: 25 additions & 0 deletions docs/autoexecs/deep_sleep_temp_sensor_http.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// source: https://www.elektroda.com/rtvforum/viewtopic.php?p=20693161#20693161
// NOTE: SHT3X is configured to store temp in channel2 and humidity in channel 3

// start driver
startDriver SHT3X
//hold button for 3 seconds to get into safe mode
addEventHandler OnHold 20 SafeMode 3
// wait for wifi to become WIFI_STA_CONNECTED
waitFor WiFiState 4
Battery_Setup 2500 4200 2.29 2400 4096
battery_measure
publishFloat "voltage" $CH4/1000
//publishFloat "battery" $CH4/25
// extra wait
delay_s 5
// measure
SHT_Measure
// send data
SendGET http://address:port/sensor1.php?temp=$CH2&hum=$CH3&bat=$voltage
// wait for GET to be sent
delay_s 5
// sleep for 120 seconds and then wake up (from blank state)
DeepSleep 120


1 change: 1 addition & 0 deletions docs/channelTypes.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,5 @@ Do not add anything here, as it will overwritten with next rebuild.
| Illuminance | Illuminance in Lux |
| Toggle_Inv | Like a Toggle, but inverted states. |
| OffOnRemember | Radio buttons with 3 options: off, on and 'remember'. This is used for TuyaMCU memory state |
| Voltage_div100 | For TuyaMCU power metering. Not used for BL09** and CSE** sensors. Divider is used by TuyaMCU, because TuyaMCU sends always values as integers so we have to divide them before displaying on UI |
| Max | This is the current total number of available channel types. |
4 changes: 4 additions & 0 deletions docs/json/autoexecExamples.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,5 +70,9 @@
{
"title": "Advanced I2C driver for multiple devices on single bus - TC74 example",
"file": "autoexecs/soft_i2c_tc74.bat"
},
{
"title": "Deep sleep usage with SHT30 sensor and data reporting via HTTP GET",
"file": "autoexecs/deep_sleep_temp_sensor_http.bat"
}
]
8 changes: 8 additions & 0 deletions docs/json/channelTypes.json
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,14 @@
"file": "new_pins.h",
"driver": ""
},
{
"name": "Voltage_div100",
"title": "TODO",
"descr": "For TuyaMCU power metering. Not used for BL09** and CSE** sensors. Divider is used by TuyaMCU, because TuyaMCU sends always values as integers so we have to divide them before displaying on UI",
"enum": "ChType_Voltage_div100",
"file": "new_pins.h",
"driver": ""
},
{
"name": "Max",
"title": "TODO",
Expand Down

0 comments on commit 92cbb9c

Please sign in to comment.