docs refresh, add Deep sleep usage with SHT30 sensor and data reporting via HTTP GET

This commit is contained in:
Tester23
2023-09-24 08:17:55 +02:00
parent 735236a3f5
commit 92cbb9ced2
6 changed files with 71 additions and 2 deletions

View File

@ -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. |

View File

@ -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
```

View File

@ -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

View File

@ -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. |

View File

@ -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"
}
]

View File

@ -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",