[docs] Add more UPK key descriptions (#219)

* Added description of some UPK keys

* More keys described.

This time by experimenting on my PIR-enabled lamp.
Motion is reported correctly via GPIO defined as pirin_pin.
I am also trying to set the PIR sensitivity by applying PWM to the pirsense_pin, and I _think_ it works. More experiments are needed.

* Add UPK2ESPHome link, reformat table

* Add descriptions from BK7231N SDK

* Update docs/resources/tuya-pin-config.md

* Corrected description of cwmaxp

* Description of ambient light sensor values

---------

Co-authored-by: Kuba Szczodrzyński <kuba@szczodrzynski.pl>
This commit is contained in:
Piotr Szulc
2023-12-08 19:13:15 +01:00
committed by GitHub
parent 9b8e00c7fa
commit bb7fcd5c4d

View File

@@ -2,14 +2,21 @@
Device configuration (`user_param_key`) can be extracted to JSON, using bk7231tools from a full firmware dump. Device configuration (`user_param_key`) can be extracted to JSON, using bk7231tools from a full firmware dump.
Originally posted [by @blakadder](https://discord.com/channels/967863521511608370/983843871320580096/1059286760074530947) on Discord channel #resources, modified by me to include more keys and values. Also see:
- [UPK2ESPHome](https://upk.libretiny.eu/)
Sources:
- [`tuya_demo_light_pwm`](https://github.com/tuya/tuya-iotos-embeded-sdk-wifi-ble-bk7231n/blob/master/apps/tuya_demo_light_pwm/include/common/device_config_load.h) for *Lights/bulbs*
- Original post [by @blakadder](https://discord.com/channels/967863521511608370/983843871320580096/1059286760074530947) on Discord channel #resources
Key(s) | Meaning | Possible values Key(s) | Meaning | Possible values
--------------------------------------------|---------------------------------------|--------------------------------------------------------- --------------------------------------------|---------------------------------------|---------------------------------------------------------------------------------------
`crc` | | `crc` | UPK data checksum |
`module` | | `module` | Tuya module used | `CB3S` / `WB3S` / `CBU`, etc.
`category` | | `category` | Device type as a number | 0502 - CW light<br>0505 - RGBCW light
`Jsonver`<br>`jv` | | `Jsonver`<br>`jv` | "JSON" version |
**Common** | | **Common** | |
`netled_pin`<br>`netled1_pin`<br>`wfst_pin` | Status LED for WiFi | `netled_pin`<br>`netled1_pin`<br>`wfst_pin` | Status LED for WiFi |
`netled_lv`<br>`netled1_lv`<br>`wfst_lv` | Status LED Active Level | 0 - Active low<br>1 - Active high `netled_lv`<br>`netled1_lv`<br>`wfst_lv` | Status LED Active Level | 0 - Active low<br>1 - Active high
@@ -20,27 +27,30 @@ Key(s) | Meaning
`iicsda` | I²C SDA Pin | `iicsda` | I²C SDA Pin |
`net_trig` | | `net_trig` | |
`net_type` | | `net_type` | |
`wfcfg` | | `spcl` / `spcl_auto` / `prod`
`wfct` | | `wfct` | |
**Lights/bulbs** | | **Lights/bulbs** | |
`cmod` | Color Mode | `rgbcw` / `rgb` / `cw` / `c` / `rgbc` `cmod` | Color Mode | `rgbcw` / `rgb` / `cw` / `c` / `rgbc`
`cwtype` | | `dmod` | Light driver type | 0 - PWM<br>1 - SM16726B<br>2 - SM2135E<br>3 - SM2135EH<br>4 - SM2135EJ<br>5 - BP1658CJ<br>6 - BP5758D<br>7 - SM2235/2335
`brightmin`, `brightmax` | Min/Max Brightness | 0%-100% `cwtype` | Color temperature driver | 0 - cool and warm white (CW)<br>1 - correlated color temperature (CCT)
`cwmin`, `cwmax` | Cold-Warm Min/Max Brightness | 0%-100% `onoffmode` | On/off gradient enabled | 0 / 1
`cwmaxp` | Cold-Warm Max Power | 0%-100% `pmemory` | Power-off memory enabled | 0 / 1
`colormin`, `colormax` | RGB Min/Max Brightness | 0%-100%
`colormaxp` | RGB Max Power | 0%-100%
`brightstep`<br>`bristep` | Brightness Step |
`defbright` | Default Brightness | 0%-100%
`defcolor` | Default Color | `c` / `r` `defcolor` | Default Color | `c` / `r`
`deftemp` | Default Color Temperature | `defbright` | Default Brightness | 0%-100%
`deftemp` | Default Color Temperature | 0-100 when defcolor is cool white
`cwmaxp` | Cold-Warm Max Power | 100-200 with a pitch of 10
`brightmin`, `brightmax` | Min/Max Brightness | 0%-100%
`colormin`, `colormax` | RGB Min/Max Brightness | 0%-100%
`cwmin`, `cwmax` | Cold-Warm Min/Max Brightness | 0%-100%
`colormaxp` | RGB Max Power | 0%-100%
`colorpfun` | Color mixing power limit enabled | 0 / 1
`brightstep`<br>`bristep` | Brightness Step |
`hsvstep` | |
`rgbt` | Used in prod.tests, not relevant |
`title20` | "title20/T20" supported | 0 / 1
**Gamma correction** | |
`gmr`, `gmg`, `gmb` | |
`gmkr`, `gmkg`, `gmkb` | | `gmkr`, `gmkg`, `gmkb` | |
`gmwr`, `gmwg`, `gmwb` | | `gmwr`, `gmwg`, `gmwb` | |
`hsvstep` | |
`rgbt` | |
`rstbr` | |
`rstcor` | | `c`/`r`
`rsttemp` | |
**PWM Lights** | | **PWM Lights** | |
`r_pin` + `r_lv` | Red Channel Pin + Active Level | `r_pin` + `r_lv` | Red Channel Pin + Active Level |
`g_pin` + `g_lv` | Green Channel Pin + Active Level | `g_pin` + `g_lv` | Green Channel Pin + Active Level |
@@ -52,8 +62,8 @@ Key(s) | Meaning
`dccur`<br>`ehccur`<br>`cjccur` | Cold White Current | `dccur`<br>`ehccur`<br>`cjccur` | Cold White Current |
`dwcur`<br>`ehwcur`<br>`cjwcur` | Warm White Current | `dwcur`<br>`ehwcur`<br>`cjwcur` | Warm White Current |
`drgbcur` | RGB Current | `drgbcur` | RGB Current |
`campere` | | `campere` | Max current of SM2135 colored output | 10-45 with a pitch of 5 and defaults to 20
`wampere` | | `wampere` | Max current of SM2135 white output | 10-80 with a pitch of 5 and defaults to 30
`iicr` | Red Channel Number | 0-5 `iicr` | Red Channel Number | 0-5
`iicg` | Green Channel Number | 0-5 `iicg` | Green Channel Number | 0-5
`iicb` | Blue Channel Number | 0-5 `iicb` | Blue Channel Number | 0-5
@@ -72,7 +82,7 @@ Key(s) | Meaning
`rl_drvtime` | | `rl_drvtime` | |
`total_bt_pin` + `total_bt_lv` | | `total_bt_pin` + `total_bt_lv` | |
**Power monitoring** | | **Power monitoring** | |
`ele_fun_en` | Power Monitoring Enabled | 1 `ele_fun_en` | Power Monitoring Enabled | 0 / 1
`chip_type` | Power Monitoring Chip Type | 0 - BL0937<br>1 - HLW8012<br>2 - HLW8032<br>4 - BL0942 `chip_type` | Power Monitoring Chip Type | 0 - BL0937<br>1 - HLW8012<br>2 - HLW8032<br>4 - BL0942
`ele_pin` | CF Pin | `ele_pin` | CF Pin |
`vi_pin` | CF1 Pin | `vi_pin` | CF1 Pin |
@@ -84,7 +94,7 @@ Key(s) | Meaning
`vol_def` | Socket operating voltage | 0 - 220V<br>1 - 110V `vol_def` | Socket operating voltage | 0 - 220V<br>1 - 110V
`work_voltage` | Socket operating voltage | `work_voltage` | Socket operating voltage |
**Infrared** | | **Infrared** | |
`irfunc` | IR Function | 0, 1 `irfunc` | IR Function enabled | 0 / 1
`infre` | IR Transmitter Pin | `infre` | IR Transmitter Pin |
`infrr`<br>`ir` | IR Receiver Pin | `infrr`<br>`ir` | IR Receiver Pin |
`irkXfun` + `irkXval` | IR Key X Function + Value | X in 1..30 `irkXfun` + `irkXval` | IR Key X Function + Value | X in 1..30
@@ -93,14 +103,20 @@ Key(s) | Meaning
`wgmod`, `swgmod`, `scgmod` | | `wgmod`, `swgmod`, `scgmod` | |
**PIR** | | **PIR** | |
`pirmod` | | `pirmod` | |
`pirfreq` | | `pirfreq` | PWM Operating Frequency (Hz) for PIR | 1000
`pirlduty` | | `pirlduty` | | 100
`pirmduty` | | `pirmduty` | | 50
`pirhduty` | | `pirhduty` | | 0
`pirin_pin` + `pirin_lv` | | `pirin_pin` + `pirin_lv` | Motion reporting GPIO + Active Level |
`pirsense_pin` + `pirsense_lv` | | `pirsense_pin` + `pirsense_lv` | PIR sensitivity (PWM) + Active Level |
`pirrange` | | `pirrange` | |
`pirwarn` | | `pirwarn` | |
**Ambient light sensor** | |
`day` | Value to compare against ADC readout | ADC value range (0-3300)
`dusk` | Value to compare against ADC readout | ADC value range (0-3300)
`evenfall` | Value to compare against ADC readout | ADC value range (0-3300)
`evening` | Value to compare against ADC readout | ADC value range (0-3300)
`night` | Value to compare against ADC readout | ADC value range (0-3300)
**Key-controlled** | | **Key-controlled** | |
`key_pin` + `key_lv` | Key Pin + Active Level | `key_pin` + `key_lv` | Key Pin + Active Level |
`kXpin_pin` + `kXpin_lv` | | `kXpin_pin` + `kXpin_lv` | |
@@ -109,9 +125,23 @@ Key(s) | Meaning
`keyccfg1`, `keyccfg2` | | `keyccfg1`, `keyccfg2` | |
`keyfunc`, `keyglobefunc` | | `keyfunc`, `keyglobefunc` | |
`keylt`, `keynumber` | | `keylt`, `keynumber` | |
**Pairing-related** | |
`wfcfg` | Wi-Fi pairing config | `spcl` / `spcl_auto` / `prod` / `old` / `low`
`remdmode` | "light reset pairing mode" | 0 / 1
`rstnum` | On/off cycles to reset |
`rstcor` | Light color while connecting | `c` / `r`
`rstbr` | Light brightness while connecting | 10-100
`rsttemp` | Light temperature while connecting | 0-100
`remdtime` | Pairing mode timeout | seconds
`wfptime` | Light pairing time | minutes
`cagt` | Used in prod.tests, not relevant | N/A
`prodagain` | Used in prod.tests, not relevant | 0 / 1
`rstmode` | Pairing related - not relevant |
`pairt` | Pairing related - not relevant | 6-600
`wt` | Used in prod.tests, not relevant | N/A
**Other** | | **Other** | |
`buzzer_pwm` | Buzzer working PWM frequency | `buzzer_pwm` | Buzzer working PWM frequency |
`ismusic` | | 0, 1 `ismusic` | | 0 / 1
`ledX_pin` + `ledX_lv` | LED X Pin + Active Level | `ledX_pin` + `ledX_lv` | LED X Pin + Active Level |
`led_pin` + `led_lv` | LED Pin + Active Level | `led_pin` + `led_lv` | LED Pin + Active Level |
**Unknown** | | **Unknown** | |
@@ -127,7 +157,6 @@ Key(s) | Meaning
`bleonoff` | | `bleonoff` | |
`blindt` | | `blindt` | |
`buzzer` | | `buzzer` | |
`cagt` | |
`cctseg` | | `cctseg` | |
`cd_flag2` | | `cd_flag2` | |
`cdsval` | | `cdsval` | |
@@ -138,24 +167,18 @@ Key(s) | Meaning
`ch_num` | | `ch_num` | |
`clean_t` | | `clean_t` | |
`cntdown1` | | `cntdown1` | |
`colorpfun` | |
`ctrl_lv` | | `ctrl_lv` | |
`ctrl_pin` | | `ctrl_pin` | |
`customcode` | | `customcode` | |
`cyc_dpid` | | `cyc_dpid` | |
`day` | |
`dctrl_select` | | `dctrl_select` | |
`dimmod` | | `dimmod` | |
`dimt` | | `dimt` | |
`dimval` | | `dimval` | |
`dmod` | |
`door1_magt_lv` | | `door1_magt_lv` | |
`door1_magt_pin` | | `door1_magt_pin` | |
`door_alarm_st1` | | `door_alarm_st1` | |
`door_mag1` | | `door_mag1` | |
`dusk` | |
`evenfall` | |
`evening` | |
`ffc_select` | | `ffc_select` | |
`inch_dp` | | `inch_dp` | |
`indep_cfgbt` | | `indep_cfgbt` | |
@@ -176,11 +199,10 @@ Key(s) | Meaning
`netnc` | | `netnc` | |
`nety_led` | | `nety_led` | |
`netyc` | | `netyc` | |
`night` | |
`nightbrig` | | `nightbrig` | |
`nightcct` | | `nightcct` | |
`nightled` | | `nightled` | |
`notdisturb` | | `notdisturb` | Do not disturb (DND) mode enabled | 0 / 1
`on_off_cnt` | | `on_off_cnt` | |
`onoff1` | | `onoff1` | |
`onoff_clear_t` | | `onoff_clear_t` | |
@@ -188,23 +210,16 @@ Key(s) | Meaning
`onoff_rst_m` | | `onoff_rst_m` | |
`onoff_rst_type` | | `onoff_rst_type` | |
`onoff_type` | | `onoff_type` | |
`onoffmode` | |
`onofftime` | | `onofftime` | |
`owm` | | `owm` | |
`pairt` | |
`pmemory` | |
`preheatt` | | `preheatt` | |
`prodagain` | |
`rand_dpid` | | `rand_dpid` | |
`remdmode` | |
`remote_add_dp` | | `remote_add_dp` | |
`remote_list_dp` | | `remote_list_dp` | |
`remote_select` | | `remote_select` | |
`resistor` | | `resistor` | |
`reuse_led_m` | | `reuse_led_m` | |
`rsthold` | | `rsthold` | |
`rstmode` | |
`rstnum` | |
`scenespct` | | `scenespct` | |
`series_ctrl` | | `series_ctrl` | |
`sfunc` | | `sfunc` | |
@@ -214,7 +229,6 @@ Key(s) | Meaning
`switch1` | | `switch1` | |
`tempmix` | | `tempmix` | |
`tempstep` | | `tempstep` | |
`title20` | |
`total_stat` | | `total_stat` | |
`tracetime1` | | `tracetime1` | |
`trigdelay` | | `trigdelay` | |
@@ -223,5 +237,4 @@ Key(s) | Meaning
`voice_ctrl1` | | `voice_ctrl1` | |
`voice_ctrl_set1` | | `voice_ctrl_set1` | |
`whiteseg` | | `whiteseg` | |
`wt` | |
`zero_select` | | `zero_select` | |