From d92bbfcb454dc9c4e4f3af70efda56f9f0ee856d Mon Sep 17 00:00:00 2001 From: Tester23 Date: Mon, 25 Dec 2023 21:10:22 +0100 Subject: [PATCH] docs refresh --- docs/README.md | 10 +++++----- docs/autoexecExamples.md | 31 +++++++++++++++++++------------ docs/channelTypes.md | 3 +++ docs/commands-extended.md | 9 ++++++--- docs/commands.md | 9 ++++++--- docs/drivers.md | 1 + docs/flags.md | 1 + docs/json/channelTypes.json | 24 ++++++++++++++++++++++++ docs/json/commands.json | 37 ++++++++++++++++++++++++++++++++----- docs/json/drivers.json | 6 ++++++ docs/json/flags.json | 7 +++++++ src/driver/drv_ntp.c | 4 ++-- 12 files changed, 112 insertions(+), 30 deletions(-) diff --git a/docs/README.md b/docs/README.md index b749e268c..9d04daf87 100644 --- a/docs/README.md +++ b/docs/README.md @@ -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) (79 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) (45 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) (45 total) | Drivers allows you to control certain peripherals or enable certain features that are off by default. | +| [Flags](https://github.com/openshwprojects/OpenBK7231T_App/blob/main/docs/flags.md) (46 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) (46 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) (32 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) (47 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' 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. | +| [Channel Types](https://github.com/openshwprojects/OpenBK7231T_App/blob/main/docs/channelTypes.md) (50 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' 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) (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) (284 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. | +| [Console/Script commands](https://github.com/openshwprojects/OpenBK7231T_App/blob/main/docs/commands.md) (287 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) (26 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) (284 total) | More details on commands. | +| [Console/Script commands [Extended Edition]](https://github.com/openshwprojects/OpenBK7231T_App/blob/main/docs/commands-extended.md) (287 total) | More details on commands. | diff --git a/docs/autoexecExamples.md b/docs/autoexecExamples.md index 7a8f7c5fc..e312220d2 100644 --- a/docs/autoexecExamples.md +++ b/docs/autoexecExamples.md @@ -759,21 +759,28 @@ goto again ``` -[Choose command/color table example (with index wrap)](https://www.elektroda.com/rtvforum/viewtopic.php?p=20863886#20863886) +[Setup for EZB-WBZS1H16N-A V1.0 Tuya mini smart switch showing sunrise/sunset events](https://www.elektroda.com/rtvforum/topic3967141.html)
-``` +```NOTE: Set Time offset, latitude, longitude accordingly -alias col1 led_basecolor_rgb 0xFF0000 -alias col2 led_basecolor_rgb 0x00FF00 -alias col3 led_basecolor_rgb 0x0000FF -alias col4 led_basecolor_rgb 0xFFFF00 -alias col5 led_basecolor_rgb 0xFF00FF -alias col6 led_basecolor_rgb 0x00FFFF +// autoexec for mini smart switch +PowerSave 1 +addEventHandler OnHold 8 SafeMode +startDriver ntp +ntp_timeZoneOfs -8 +ntp_setLatlong 44.002130 -123.091473 +setPinRole 6 WifiLed_n +setPinRole 8 Btn_Tgl_All +setPinRole 14 TglChanOnTgl +setPinChannel 14 0 +setPinRole 15 Rel +setPinChannel 15 0 +removeClockEvent 12 +removeClockEvent 13 +waitFor NTPState 1 +addClockEvent sunrise 0x7f 12 POWER OFF +addClockEvent sunset 0x7f 13 POWER ON -// use choice to choose effect by index stored in $CH10 -alias do_chosen_effect Choice $CH10 col1 col2 col3 col4 col5 col6 -// 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 5 1; do_chosen_effect ``` diff --git a/docs/channelTypes.md b/docs/channelTypes.md index 16276707f..bd13afbec 100644 --- a/docs/channelTypes.md +++ b/docs/channelTypes.md @@ -51,4 +51,7 @@ Do not add anything here, as it will overwritten with next rebuild. | TimerSeconds | This will display time formatted to minutes, hours, etc. | | Frequency_div10 | 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 | | PowerFactor_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 | +| Pressure_div100 | . | +| Temperature_div100 | Just like humidity_div100, but for temperature. | +| LeakageCurrent_div1000 | . | | Max | This is the current total number of available channel types. | diff --git a/docs/commands-extended.md b/docs/commands-extended.md index f37b26dce..2e738fe7a 100644 --- a/docs/commands-extended.md +++ b/docs/commands-extended.md @@ -9,7 +9,7 @@ Do not add anything here, as it will overwritten with next rebuild. | ADCSmoother | [Pindex] [TotalSamples] [SampleIntervalMS] [TargetChannelADCValue] [MarginValue] [TargetChannel0or1] | Starts the ADC smoother with given configuration.

See also [ADCSmoother on forum](https://www.elektroda.com/rtvforum/find.php?q=ADCSmoother). | File: driver/drv_adcSmoother.c
Function: NULL); | | AddChangeHandler | [Variable][Relation][Constant][Command] | This can listen to change in channel value (for example channel 0 becoming 100), or for a voltage/current/power change for BL0942/BL0937. This supports multiple relations, like ==, !=, >=, < etc. The Variable name for channel is Channel0, Channel2, etc, for BL0XXX it can be 'Power', or 'Current' or 'Voltage'.

See also [AddChangeHandler on forum](https://www.elektroda.com/rtvforum/find.php?q=AddChangeHandler). | File: cmnds/cmd_eventHandlers.c
Function: CMD_AddChangeHandler | | AddChannel | [ChannelIndex][ValueToAdd][ClampMin][ClampMax][bWrapInsteadOfClamp] | Adds a given value to the channel. Can be used to change PWM brightness. Clamp min and max arguments are optional.

See also [AddChannel on forum](https://www.elektroda.com/rtvforum/find.php?q=AddChannel). | File: cmnds/cmd_channels.c
Function: CMD_AddChannel | -| addClockEvent | [Time] [WeekDayFlags] [UniqueIDForRemoval][Command] | Schedule command to run on given time in given day of week. NTP must be running. Time is a time like HH:mm or HH:mm:ss, WeekDayFlag is a bitflag on which day to run, 0xff mean all days, 0x01 means sunday, 0x02 monday, 0x03 sunday and monday, etc, id is an unique id so event can be removede later.

See also [addClockEvent on forum](https://www.elektroda.com/rtvforum/find.php?q=addClockEvent). | File: driver/drv_ntp_events.c
Function: CMD_NTP_AddClockEvent | +| addClockEvent | [Time or sunrise or sunset] [WeekDayFlags] [UniqueIDForRemoval][Command] | Schedule command to run on given time in given day of week. NTP must be running. Time is a time like HH:mm or HH:mm:ss, WeekDayFlag is a bitflag on which day to run, 0xff mean all days, 0x01 means sunday, 0x02 monday, 0x03 sunday and monday, etc, id is an unique id so event can be removed later. (NOTE: Use of sunrise/sunset requires compiling with ENABLE_NTP_SUNRISE_SUNSET set which adds about 11k of code.

See also [addClockEvent on forum](https://www.elektroda.com/rtvforum/find.php?q=addClockEvent). | File: driver/drv_ntp_events.c
Function: CMD_NTP_AddClockEvent | | AddEventHandler | [EventName][EventArgument][CommandToRun] | This can be used to trigger an action on a button click, long press, etc.

See also [AddEventHandler on forum](https://www.elektroda.com/rtvforum/find.php?q=AddEventHandler). | File: cmnds/cmd_eventHandlers.c
Function: CMD_AddEventHandler | | addI2CDevice_LCD_PCF8574 | | Adds a new I2C device - PCF8574.

See also [addI2CDevice_LCD_PCF8574 on forum](https://www.elektroda.com/rtvforum/find.php?q=addI2CDevice_LCD_PCF8574). | File: i2c/drv_i2c_main.c
Function: DRV_I2C_AddDevice_PCF8574 | | addI2CDevice_LCM1602 | | Adds a new I2C device - LCM1602.

See also [addI2CDevice_LCM1602 on forum](https://www.elektroda.com/rtvforum/find.php?q=addI2CDevice_LCM1602). | File: i2c/drv_i2c_main.c
Function: DRV_I2C_AddDevice_LCM1602 | @@ -60,7 +60,7 @@ Do not add anything here, as it will overwritten with next rebuild. | DGR_SendRGBCW | [GroupName][HexRGBCW] | Sends a RGBCW message to given Tasmota Device Group with no reliability. Requires no prior setup and can control any group, but won't retransmit. You can use this command in two ways, first is like DGR_SendRGBCW GroupName 255 255 0, etc, second is DGR_SendRGBCW GroupName FF00FF00 etc etc.

See also [DGR_SendRGBCW on forum](https://www.elektroda.com/rtvforum/find.php?q=DGR_SendRGBCW). | File: driver/drv_tasmotaDeviceGroups.c
Function: CMD_DGR_SendRGBCW | | Dimmer | [Value] | Alias for led_dimmer.

See also [Dimmer on forum](https://www.elektroda.com/rtvforum/find.php?q=Dimmer). | File: cmnds/cmd_newLEDDriver.c
Function: dimmer | | DimmerDelta | [DeltaValue] | This sets the delta value for SmartDimmer/SmartButtonForLEDs hold event. This determines the amount of change of dimmer per hold event.

See also [DimmerDelta on forum](https://www.elektroda.com/rtvforum/find.php?q=DimmerDelta). | File: cmnds/cmd_newLEDDriver.c
Function: dimmerDelta | -| DSEdge | [edgeCode] | DeepSleep (PinDeepSleep) wake configuration command. 0 means always wake up on rising edge, 1 means on falling, 2 means if state is high, use falling edge, if low, use rising. Default is 2.

See also [DSEdge on forum](https://www.elektroda.com/rtvforum/find.php?q=DSEdge). | File: drv/drv_doorSensorWithDeepSleep.c
Function: CMD_DeepSleep_SetEdge | +| DSEdge | [edgeCode][optionalPinIndex] | DeepSleep (PinDeepSleep) wake configuration command. 0 means always wake up on rising edge, 1 means on falling, 2 means if state is high, use falling edge, if low, use rising. Default is 2. Second argument is optional and allows to set per-pin DSEdge instead of setting it for all pins.

See also [DSEdge on forum](https://www.elektroda.com/rtvforum/find.php?q=DSEdge). | File: drv/drv_doorSensorWithDeepSleep.c
Function: CMD_DeepSleep_SetEdge | | DSTime | [timeSeconds] | DoorSensor driver configuration command. Time to keep device running before next sleep after last door sensor change. In future we may add also an option to automatically sleep after MQTT confirms door state receival.

See also [DSTime on forum](https://www.elektroda.com/rtvforum/find.php?q=DSTime). | File: drv/drv_doorSensorWithDeepSleep.c
Function: DoorDeepSleep_SetTime | | echo | [Message] | Sends given message back to console. This command expands variables, so writing $CH12 will print value of channel 12, etc. Remember that you can also use special channel indices to access persistant flash variables and to access LED variables like dimmer, etc.

See also [echo on forum](https://www.elektroda.com/rtvforum/find.php?q=echo). | File: cmnds/cmd_main.c
Function: CMD_Echo | | EnergyCntReset | | Resets the total Energy Counter, the one that is usually kept after device reboots. After this commands, the counter will start again from 0.

See also [EnergyCntReset on forum](https://www.elektroda.com/rtvforum/find.php?q=EnergyCntReset). | File: driver/drv_bl_shared.c
Function: BL09XX_ResetEnergyCounter | @@ -151,6 +151,7 @@ Do not add anything here, as it will overwritten with next rebuild. | mqtt_broadcastInterval | [ValueSeconds] | If broadcast self state every 60 seconds/minute is enabled in flags, this value allows you to change the delay, change this 60 seconds to any other value in seconds. This value is not saved, you must use autoexec.bat or short startup command to execute it on every reboot.

See also [mqtt_broadcastInterval on forum](https://www.elektroda.com/rtvforum/find.php?q=mqtt_broadcastInterval). | File: mqtt/new_mqtt.c
Function: MQTT_SetBroadcastInterval | | mqtt_broadcastItemsPerSec | [PublishCountPerSecond] | If broadcast self state (this option in flags) is started, then gradually device info is published, with a speed of N publishes per second. Do not set too high value, it may overload LWIP MQTT library. This value is not saved, you must use autoexec.bat or short startup command to execute it on every reboot.

See also [mqtt_broadcastItemsPerSec on forum](https://www.elektroda.com/rtvforum/find.php?q=mqtt_broadcastItemsPerSec). | File: mqtt/new_mqtt.c
Function: MQTT_SetMaxBroadcastItemsPublishedPerSecond | | ntp_info | | Display NTP related settings.

See also [ntp_info on forum](https://www.elektroda.com/rtvforum/find.php?q=ntp_info). | File: driver/drv_ntp.c
Function: NTP_Info | +| ntp_setLatLong | [Latlong] | Sets the NTP latitude and longitude.

Example: NTP_SetLatlong -34.911498 138.809488

See also [ntp_setLatLong on forum](https://www.elektroda.com/rtvforum/find.php?q=ntp_setLatLong). | File: driver/drv_ntp.c
Function: NTP_SetLatlong | | ntp_setServer | [ServerIP] | Sets the NTP server.

See also [ntp_setServer on forum](https://www.elektroda.com/rtvforum/find.php?q=ntp_setServer). | File: driver/drv_ntp.c
Function: NTP_SetServer | | ntp_timeZoneOfs | [Value] | Sets the time zone offset in hours. Also supports HH:MM syntax if you want to specify value in minutes. For negative values, use -HH:MM syntax, for example -5:30 will shift time by 5 hours and 30 minutes negative.

See also [ntp_timeZoneOfs on forum](https://www.elektroda.com/rtvforum/find.php?q=ntp_timeZoneOfs). | File: driver/drv_ntp.c
Function: NTP_SetTimeZoneOfs | | obkDeviceList | | Generate the SSDP list of OpenBeken devices found on the network.

See also [obkDeviceList on forum](https://www.elektroda.com/rtvforum/find.php?q=obkDeviceList). | File: driver/drv_ssdp.c
Function: Cmd_obkDeviceList | @@ -172,6 +173,7 @@ Do not add anything here, as it will overwritten with next rebuild. | publishChannels | | Starts the step by step publish of all channel values.

See also [publishChannels on forum](https://www.elektroda.com/rtvforum/find.php?q=publishChannels). | File: mqtt/new_mqtt.c
Function: MQTT_PublishChannels | | publishFloat | [Topic][Value] | Publishes data by MQTT. The final topic will be obk0696FB33/[Topic]/get, but you can also publish under raw topic, by adding third argument - '1'.. You can use argument expansion here, so $CH11 will change to value of the channel 11. This version of command publishes an float, so you can also use math expressions like $CH10*0.0, etc.

See also [publishFloat on forum](https://www.elektroda.com/rtvforum/find.php?q=publishFloat). | File: mqtt/new_mqtt.c
Function: MQTT_PublishCommand | | publishInt | [Topic][Value] | Publishes data by MQTT. The final topic will be obk0696FB33/[Topic]/get, but you can also publish under raw topic, by adding third argument - '1'.. You can use argument expansion here, so $CH11 will change to value of the channel 11. This version of command publishes an integer, so you can also use math expressions like $CH10*10, etc.

See also [publishInt on forum](https://www.elektroda.com/rtvforum/find.php?q=publishInt). | File: mqtt/new_mqtt.c
Function: MQTT_PublishCommand | +| PWMG_Setup | CMD_PWMG_Setup | .

See also [PWMG_Setup on forum](https://www.elektroda.com/rtvforum/find.php?q=PWMG_Setup). | File: driver/drv_pwm_groups.c
Function: NULL); | | reboot | | Same as restart. Needed for bkWriter 1.60 which sends 'reboot' cmd before trying to get bus.

See also [reboot on forum](https://www.elektroda.com/rtvforum/find.php?q=reboot). | File: cmnds/cmd_main.c
Function: CMD_Restart | | removeClockEvent | [ID] | Removes clock event wtih given ID.

See also [removeClockEvent on forum](https://www.elektroda.com/rtvforum/find.php?q=removeClockEvent). | File: driver/drv_ntp_events.c
Function: CMD_NTP_RemoveClockEvent | | resetSVM | | Resets all SVM and clears all scripts.

See also [resetSVM on forum](https://www.elektroda.com/rtvforum/find.php?q=resetSVM). | File: cmnds/cmd_script.c
Function: CMD_resetSVM | @@ -228,6 +230,7 @@ Do not add anything here, as it will overwritten with next rebuild. | SM2235_Current | [Value] | Sets the maximum current for LED driver.

See also [SM2235_Current on forum](https://www.elektroda.com/rtvforum/find.php?q=SM2235_Current). | File: driver/drv_sm2235.c
Function: SM2235_Current | | SM2235_Map | [Ch0][Ch1][Ch2][Ch3][Ch4] | Maps the RGBCW values to given indices of SM2235 channels. This is because SM2235 channels order is not the same for some devices. Some devices are using RGBCW order and some are using GBRCW, etc, etc. Example usage: SM2235_Map 0 1 2 3 4.

See also [SM2235_Map on forum](https://www.elektroda.com/rtvforum/find.php?q=SM2235_Map). | File: driver/drv_sm2235.c
Function: SM2235_Map | | SM2235_RGBCW | [HexColor] | Don't use it. It's for direct access of SM2235 driver. You don't need it because LED driver automatically calls it, so just use led_basecolor_rgb.

See also [SM2235_RGBCW on forum](https://www.elektroda.com/rtvforum/find.php?q=SM2235_RGBCW). | File: driver/drv_sm2235.c
Function: SM2235_RGBCW | +| SPC | [Index][RGB] | Sets Palette Color by index.

See also [SPC on forum](https://www.elektroda.com/rtvforum/find.php?q=SPC). | File: cmnds/cmd_newLEDDriver.c
Function: commandSetPaletteColor | | SPITestFlash_Erase | CMD_SPITestFlash_Erase | .

See also [SPITestFlash_Erase on forum](https://www.elektroda.com/rtvforum/find.php?q=SPITestFlash_Erase). | File: driver/drv_spi_flash.c
Function: NULL); | | SPITestFlash_ReadData | CMD_SPITestFlash_ReadData | .

See also [SPITestFlash_ReadData on forum](https://www.elektroda.com/rtvforum/find.php?q=SPITestFlash_ReadData). | File: cmnds/cmd_main.c
Function: NULL); | | SPITestFlash_ReadID | CMD_SPITestFlash_ReadID | .

See also [SPITestFlash_ReadID on forum](https://www.elektroda.com/rtvforum/find.php?q=SPITestFlash_ReadID). | File: cmnds/cmd_main.c
Function: NULL); | @@ -263,7 +266,7 @@ Do not add anything here, as it will overwritten with next rebuild. | toggler_channel | [ChannelIndex] | Handles toggler_channel0, toggler_channel1. Sets channel linked to given toggler slot.

See also [toggler_channel on forum](https://www.elektroda.com/rtvforum/find.php?q=toggler_channel). | File: driver/drv_pwmToggler.c
Function: Toggler_ChannelX | | toggler_enable | [1or0] | Sets the given output ON or OFF. handles toggler_enable0, toggler_enable1, etc.

See also [toggler_enable on forum](https://www.elektroda.com/rtvforum/find.php?q=toggler_enable). | File: driver/drv_pwmToggler.c
Function: Toggler_EnableX | | toggler_name | | Handles toggler_name0, toggler_name1, etc. Sets the name of a toggler for GUI.

See also [toggler_name on forum](https://www.elektroda.com/rtvforum/find.php?q=toggler_name). | File: driver/drv_pwmToggler.c
Function: Toggler_NameX | -| toggler_set | [Value] | Sets the VALUE of given output. Handles toggler_set0, toggler_set1, etc. The last digit after command name is changed to slot index.

See also [toggler_set on forum](https://www.elektroda.com/rtvforum/find.php?q=toggler_set). | File: driver/drv_pwmToggler.c
Function: Toggler_SetX | +| toggler_set | [Value] | Sets the VALUE of given output. Handles toggler_set0, toggler_set1, etc. The last digit after command name is changed to slot index. It can also add to current value if you write value like +25 and subtract if you prefix it with - like -25.

See also [toggler_set on forum](https://www.elektroda.com/rtvforum/find.php?q=toggler_set). | File: driver/drv_pwmToggler.c
Function: Toggler_SetX | | TS_Clear | | Clears the text scroller buffer.

See also [TS_Clear on forum](https://www.elektroda.com/rtvforum/find.php?q=TS_Clear). | File: driver/drv_textScroller.c
Function: NULL); | | TS_Print | [StartOfs] [MaxLenOr0] [StringText] [optionalBClampWithZeroesForClock] | Prints a text to the text scroller buffer.

See also [TS_Print on forum](https://www.elektroda.com/rtvforum/find.php?q=TS_Print). | File: driver/drv_textScroller.c
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).

See also [tuyaMcu_defWiFiState on forum](https://www.elektroda.com/rtvforum/find.php?q=tuyaMcu_defWiFiState). | File: driver/drv_tuyaMCU.c
Function: Cmd_TuyaMCU_Send_RSSI | diff --git a/docs/commands.md b/docs/commands.md index ef0679e23..cc30b633c 100644 --- a/docs/commands.md +++ b/docs/commands.md @@ -12,7 +12,7 @@ Do not add anything here, as it will overwritten with next rebuild. | ADCSmoother | [Pindex] [TotalSamples] [SampleIntervalMS] [TargetChannelADCValue] [MarginValue] [TargetChannel0or1] | Starts the ADC smoother with given configuration.

See also [ADCSmoother on forum](https://www.elektroda.com/rtvforum/find.php?q=ADCSmoother). | | AddChangeHandler | [Variable][Relation][Constant][Command] | This can listen to change in channel value (for example channel 0 becoming 100), or for a voltage/current/power change for BL0942/BL0937. This supports multiple relations, like ==, !=, >=, < etc. The Variable name for channel is Channel0, Channel2, etc, for BL0XXX it can be 'Power', or 'Current' or 'Voltage'.

See also [AddChangeHandler on forum](https://www.elektroda.com/rtvforum/find.php?q=AddChangeHandler). | | AddChannel | [ChannelIndex][ValueToAdd][ClampMin][ClampMax][bWrapInsteadOfClamp] | Adds a given value to the channel. Can be used to change PWM brightness. Clamp min and max arguments are optional.

See also [AddChannel on forum](https://www.elektroda.com/rtvforum/find.php?q=AddChannel). | -| addClockEvent | [Time] [WeekDayFlags] [UniqueIDForRemoval][Command] | Schedule command to run on given time in given day of week. NTP must be running. Time is a time like HH:mm or HH:mm:ss, WeekDayFlag is a bitflag on which day to run, 0xff mean all days, 0x01 means sunday, 0x02 monday, 0x03 sunday and monday, etc, id is an unique id so event can be removede later.

See also [addClockEvent on forum](https://www.elektroda.com/rtvforum/find.php?q=addClockEvent). | +| addClockEvent | [Time or sunrise or sunset] [WeekDayFlags] [UniqueIDForRemoval][Command] | Schedule command to run on given time in given day of week. NTP must be running. Time is a time like HH:mm or HH:mm:ss, WeekDayFlag is a bitflag on which day to run, 0xff mean all days, 0x01 means sunday, 0x02 monday, 0x03 sunday and monday, etc, id is an unique id so event can be removed later. (NOTE: Use of sunrise/sunset requires compiling with ENABLE_NTP_SUNRISE_SUNSET set which adds about 11k of code.

See also [addClockEvent on forum](https://www.elektroda.com/rtvforum/find.php?q=addClockEvent). | | AddEventHandler | [EventName][EventArgument][CommandToRun] | This can be used to trigger an action on a button click, long press, etc.

See also [AddEventHandler on forum](https://www.elektroda.com/rtvforum/find.php?q=AddEventHandler). | | addI2CDevice_LCD_PCF8574 | | Adds a new I2C device - PCF8574.

See also [addI2CDevice_LCD_PCF8574 on forum](https://www.elektroda.com/rtvforum/find.php?q=addI2CDevice_LCD_PCF8574). | | addI2CDevice_LCM1602 | | Adds a new I2C device - LCM1602.

See also [addI2CDevice_LCM1602 on forum](https://www.elektroda.com/rtvforum/find.php?q=addI2CDevice_LCM1602). | @@ -63,7 +63,7 @@ Do not add anything here, as it will overwritten with next rebuild. | DGR_SendRGBCW | [GroupName][HexRGBCW] | Sends a RGBCW message to given Tasmota Device Group with no reliability. Requires no prior setup and can control any group, but won't retransmit. You can use this command in two ways, first is like DGR_SendRGBCW GroupName 255 255 0, etc, second is DGR_SendRGBCW GroupName FF00FF00 etc etc.

See also [DGR_SendRGBCW on forum](https://www.elektroda.com/rtvforum/find.php?q=DGR_SendRGBCW). | | Dimmer | [Value] | Alias for led_dimmer.

See also [Dimmer on forum](https://www.elektroda.com/rtvforum/find.php?q=Dimmer). | | DimmerDelta | [DeltaValue] | This sets the delta value for SmartDimmer/SmartButtonForLEDs hold event. This determines the amount of change of dimmer per hold event.

See also [DimmerDelta on forum](https://www.elektroda.com/rtvforum/find.php?q=DimmerDelta). | -| DSEdge | [edgeCode] | DeepSleep (PinDeepSleep) wake configuration command. 0 means always wake up on rising edge, 1 means on falling, 2 means if state is high, use falling edge, if low, use rising. Default is 2.

See also [DSEdge on forum](https://www.elektroda.com/rtvforum/find.php?q=DSEdge). | +| DSEdge | [edgeCode][optionalPinIndex] | DeepSleep (PinDeepSleep) wake configuration command. 0 means always wake up on rising edge, 1 means on falling, 2 means if state is high, use falling edge, if low, use rising. Default is 2. Second argument is optional and allows to set per-pin DSEdge instead of setting it for all pins.

See also [DSEdge on forum](https://www.elektroda.com/rtvforum/find.php?q=DSEdge). | | DSTime | [timeSeconds] | DoorSensor driver configuration command. Time to keep device running before next sleep after last door sensor change. In future we may add also an option to automatically sleep after MQTT confirms door state receival.

See also [DSTime on forum](https://www.elektroda.com/rtvforum/find.php?q=DSTime). | | echo | [Message] | Sends given message back to console. This command expands variables, so writing $CH12 will print value of channel 12, etc. Remember that you can also use special channel indices to access persistant flash variables and to access LED variables like dimmer, etc.

See also [echo on forum](https://www.elektroda.com/rtvforum/find.php?q=echo). | | EnergyCntReset | | Resets the total Energy Counter, the one that is usually kept after device reboots. After this commands, the counter will start again from 0.

See also [EnergyCntReset on forum](https://www.elektroda.com/rtvforum/find.php?q=EnergyCntReset). | @@ -154,6 +154,7 @@ Do not add anything here, as it will overwritten with next rebuild. | mqtt_broadcastInterval | [ValueSeconds] | If broadcast self state every 60 seconds/minute is enabled in flags, this value allows you to change the delay, change this 60 seconds to any other value in seconds. This value is not saved, you must use autoexec.bat or short startup command to execute it on every reboot.

See also [mqtt_broadcastInterval on forum](https://www.elektroda.com/rtvforum/find.php?q=mqtt_broadcastInterval). | | mqtt_broadcastItemsPerSec | [PublishCountPerSecond] | If broadcast self state (this option in flags) is started, then gradually device info is published, with a speed of N publishes per second. Do not set too high value, it may overload LWIP MQTT library. This value is not saved, you must use autoexec.bat or short startup command to execute it on every reboot.

See also [mqtt_broadcastItemsPerSec on forum](https://www.elektroda.com/rtvforum/find.php?q=mqtt_broadcastItemsPerSec). | | ntp_info | | Display NTP related settings.

See also [ntp_info on forum](https://www.elektroda.com/rtvforum/find.php?q=ntp_info). | +| ntp_setLatLong | [Latlong] | Sets the NTP latitude and longitude.

Example: NTP_SetLatlong -34.911498 138.809488

See also [ntp_setLatLong on forum](https://www.elektroda.com/rtvforum/find.php?q=ntp_setLatLong). | | ntp_setServer | [ServerIP] | Sets the NTP server.

See also [ntp_setServer on forum](https://www.elektroda.com/rtvforum/find.php?q=ntp_setServer). | | ntp_timeZoneOfs | [Value] | Sets the time zone offset in hours. Also supports HH:MM syntax if you want to specify value in minutes. For negative values, use -HH:MM syntax, for example -5:30 will shift time by 5 hours and 30 minutes negative.

See also [ntp_timeZoneOfs on forum](https://www.elektroda.com/rtvforum/find.php?q=ntp_timeZoneOfs). | | obkDeviceList | | Generate the SSDP list of OpenBeken devices found on the network.

See also [obkDeviceList on forum](https://www.elektroda.com/rtvforum/find.php?q=obkDeviceList). | @@ -175,6 +176,7 @@ Do not add anything here, as it will overwritten with next rebuild. | publishChannels | | Starts the step by step publish of all channel values.

See also [publishChannels on forum](https://www.elektroda.com/rtvforum/find.php?q=publishChannels). | | publishFloat | [Topic][Value] | Publishes data by MQTT. The final topic will be obk0696FB33/[Topic]/get, but you can also publish under raw topic, by adding third argument - '1'.. You can use argument expansion here, so $CH11 will change to value of the channel 11. This version of command publishes an float, so you can also use math expressions like $CH10*0.0, etc.

See also [publishFloat on forum](https://www.elektroda.com/rtvforum/find.php?q=publishFloat). | | publishInt | [Topic][Value] | Publishes data by MQTT. The final topic will be obk0696FB33/[Topic]/get, but you can also publish under raw topic, by adding third argument - '1'.. You can use argument expansion here, so $CH11 will change to value of the channel 11. This version of command publishes an integer, so you can also use math expressions like $CH10*10, etc.

See also [publishInt on forum](https://www.elektroda.com/rtvforum/find.php?q=publishInt). | +| PWMG_Setup | CMD_PWMG_Setup | .

See also [PWMG_Setup on forum](https://www.elektroda.com/rtvforum/find.php?q=PWMG_Setup). | | reboot | | Same as restart. Needed for bkWriter 1.60 which sends 'reboot' cmd before trying to get bus.

See also [reboot on forum](https://www.elektroda.com/rtvforum/find.php?q=reboot). | | removeClockEvent | [ID] | Removes clock event wtih given ID.

See also [removeClockEvent on forum](https://www.elektroda.com/rtvforum/find.php?q=removeClockEvent). | | resetSVM | | Resets all SVM and clears all scripts.

See also [resetSVM on forum](https://www.elektroda.com/rtvforum/find.php?q=resetSVM). | @@ -231,6 +233,7 @@ Do not add anything here, as it will overwritten with next rebuild. | SM2235_Current | [Value] | Sets the maximum current for LED driver.

See also [SM2235_Current on forum](https://www.elektroda.com/rtvforum/find.php?q=SM2235_Current). | | SM2235_Map | [Ch0][Ch1][Ch2][Ch3][Ch4] | Maps the RGBCW values to given indices of SM2235 channels. This is because SM2235 channels order is not the same for some devices. Some devices are using RGBCW order and some are using GBRCW, etc, etc. Example usage: SM2235_Map 0 1 2 3 4.

See also [SM2235_Map on forum](https://www.elektroda.com/rtvforum/find.php?q=SM2235_Map). | | SM2235_RGBCW | [HexColor] | Don't use it. It's for direct access of SM2235 driver. You don't need it because LED driver automatically calls it, so just use led_basecolor_rgb.

See also [SM2235_RGBCW on forum](https://www.elektroda.com/rtvforum/find.php?q=SM2235_RGBCW). | +| SPC | [Index][RGB] | Sets Palette Color by index.

See also [SPC on forum](https://www.elektroda.com/rtvforum/find.php?q=SPC). | | SPITestFlash_Erase | CMD_SPITestFlash_Erase | .

See also [SPITestFlash_Erase on forum](https://www.elektroda.com/rtvforum/find.php?q=SPITestFlash_Erase). | | SPITestFlash_ReadData | CMD_SPITestFlash_ReadData | .

See also [SPITestFlash_ReadData on forum](https://www.elektroda.com/rtvforum/find.php?q=SPITestFlash_ReadData). | | SPITestFlash_ReadID | CMD_SPITestFlash_ReadID | .

See also [SPITestFlash_ReadID on forum](https://www.elektroda.com/rtvforum/find.php?q=SPITestFlash_ReadID). | @@ -266,7 +269,7 @@ Do not add anything here, as it will overwritten with next rebuild. | toggler_channel | [ChannelIndex] | Handles toggler_channel0, toggler_channel1. Sets channel linked to given toggler slot.

See also [toggler_channel on forum](https://www.elektroda.com/rtvforum/find.php?q=toggler_channel). | | toggler_enable | [1or0] | Sets the given output ON or OFF. handles toggler_enable0, toggler_enable1, etc.

See also [toggler_enable on forum](https://www.elektroda.com/rtvforum/find.php?q=toggler_enable). | | toggler_name | | Handles toggler_name0, toggler_name1, etc. Sets the name of a toggler for GUI.

See also [toggler_name on forum](https://www.elektroda.com/rtvforum/find.php?q=toggler_name). | -| toggler_set | [Value] | Sets the VALUE of given output. Handles toggler_set0, toggler_set1, etc. The last digit after command name is changed to slot index.

See also [toggler_set on forum](https://www.elektroda.com/rtvforum/find.php?q=toggler_set). | +| toggler_set | [Value] | Sets the VALUE of given output. Handles toggler_set0, toggler_set1, etc. The last digit after command name is changed to slot index. It can also add to current value if you write value like +25 and subtract if you prefix it with - like -25.

See also [toggler_set on forum](https://www.elektroda.com/rtvforum/find.php?q=toggler_set). | | TS_Clear | | Clears the text scroller buffer.

See also [TS_Clear on forum](https://www.elektroda.com/rtvforum/find.php?q=TS_Clear). | | TS_Print | [StartOfs] [MaxLenOr0] [StringText] [optionalBClampWithZeroesForClock] | Prints a text to the text scroller buffer.

See also [TS_Print on forum](https://www.elektroda.com/rtvforum/find.php?q=TS_Print). | | 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).

See also [tuyaMcu_defWiFiState on forum](https://www.elektroda.com/rtvforum/find.php?q=tuyaMcu_defWiFiState). | diff --git a/docs/drivers.md b/docs/drivers.md index 115d17dd7..f9611afb6 100644 --- a/docs/drivers.md +++ b/docs/drivers.md @@ -16,6 +16,7 @@ Do not add anything here, as it will overwritten with next rebuild. | I2C | Generic I2C, not used for LED drivers, but may be useful for displays or port expanders. Supports both hardware and software I2C.
See also [I2C on forum](https://www.elektroda.com/rtvforum/find.php?q=I2C). | | qq | Bqqqqqqqqqq .
See also [qq on forum](https://www.elektroda.com/rtvforum/find.php?q=qq). | | BL0942 | BL0942 is a power-metering chip which uses UART protocol for communication. It's usually connected to TX1/RX1 port of BK. You need to calibrate power metering once, just like in Tasmota. See [LSPA9 teardown example](https://www.elektroda.com/rtvforum/topic3887748.html). .
See also [BL0942 on forum](https://www.elektroda.com/rtvforum/find.php?q=BL0942). | +| PWMG | .
See also [PWMG on forum](https://www.elektroda.com/rtvforum/find.php?q=PWMG). | | BL0942SPI | BL0942 is a power-metering chip which uses SPI protocol for communication. It's usually connected to SPI1 port of BK. You need to calibrate power metering once, just like in Tasmota. See [PZIOT-E01 teardown example](https://www.elektroda.com/rtvforum/topic3945667.html). .
See also [BL0942SPI on forum](https://www.elektroda.com/rtvforum/find.php?q=BL0942SPI). | | ChargingLimit | Mechanism to perform an action based on a max. delta value and max time. Used to control Electric Vehicle chargers. See [discussion](https://github.com/openshwprojects/OpenBK7231T_App/issues/892).
See also [ChargingLimit on forum](https://www.elektroda.com/rtvforum/find.php?q=ChargingLimit). | | BL0937 | BL0937 is a power-metering chip which uses custom protocol to report data. It requires setting 3 pins in pin config: CF, CF1 and SEL.
See also [BL0937 on forum](https://www.elektroda.com/rtvforum/find.php?q=BL0937). | diff --git a/docs/flags.md b/docs/flags.md index e639ed70a..e769ff8bc 100644 --- a/docs/flags.md +++ b/docs/flags.md @@ -50,3 +50,4 @@ Do not add anything here, as it will overwritten with next rebuild. | 42 | [DoorSensor] Invert state | | 43 | [TuyaMCU] Use queue | | 44 | [HTTP] Disable authentication in safe mode (not recommended) | +| 45 | [MQTT Discovery] Don't merge toggles and dimmers into lights | diff --git a/docs/json/channelTypes.json b/docs/json/channelTypes.json index 4ea6c51f9..d342e68c1 100644 --- a/docs/json/channelTypes.json +++ b/docs/json/channelTypes.json @@ -367,6 +367,30 @@ "file": "new_pins.h", "driver": "" }, + { + "name": "Pressure_div100", + "title": "TODO", + "descr": ".", + "enum": "Pressure_div100", + "file": "new_pins.h", + "driver": "" + }, + { + "name": "Temperature_div100", + "title": "TODO", + "descr": "Just like humidity_div100, but for temperature.", + "enum": "ChType_Temperature_div100", + "file": "new_pins.h", + "driver": "" + }, + { + "name": "LeakageCurrent_div1000", + "title": "TODO", + "descr": ".", + "enum": "ChType_LeakageCurrent_div1000", + "file": "new_pins.h", + "driver": "" + }, { "name": "Max", "title": "TODO", diff --git a/docs/json/commands.json b/docs/json/commands.json index 8b9bc9675..c6ea3725b 100644 --- a/docs/json/commands.json +++ b/docs/json/commands.json @@ -37,8 +37,8 @@ }, { "name": "addClockEvent", - "args": "[Time] [WeekDayFlags] [UniqueIDForRemoval][Command]", - "descr": "Schedule command to run on given time in given day of week. NTP must be running. Time is a time like HH:mm or HH:mm:ss, WeekDayFlag is a bitflag on which day to run, 0xff mean all days, 0x01 means sunday, 0x02 monday, 0x03 sunday and monday, etc, id is an unique id so event can be removede later", + "args": "[Time or sunrise or sunset] [WeekDayFlags] [UniqueIDForRemoval][Command]", + "descr": "Schedule command to run on given time in given day of week. NTP must be running. Time is a time like HH:mm or HH:mm:ss, WeekDayFlag is a bitflag on which day to run, 0xff mean all days, 0x01 means sunday, 0x02 monday, 0x03 sunday and monday, etc, id is an unique id so event can be removed later. (NOTE: Use of sunrise/sunset requires compiling with ENABLE_NTP_SUNRISE_SUNSET set which adds about 11k of code", "fn": "CMD_NTP_AddClockEvent", "file": "driver/drv_ntp_events.c", "requires": "", @@ -496,8 +496,8 @@ }, { "name": "DSEdge", - "args": "[edgeCode]", - "descr": "DeepSleep (PinDeepSleep) wake configuration command. 0 means always wake up on rising edge, 1 means on falling, 2 means if state is high, use falling edge, if low, use rising. Default is 2", + "args": "[edgeCode][optionalPinIndex]", + "descr": "DeepSleep (PinDeepSleep) wake configuration command. 0 means always wake up on rising edge, 1 means on falling, 2 means if state is high, use falling edge, if low, use rising. Default is 2. Second argument is optional and allows to set per-pin DSEdge instead of setting it for all pins.", "fn": "CMD_DeepSleep_SetEdge", "file": "drv/drv_doorSensorWithDeepSleep.c", "requires": "", @@ -1313,6 +1313,15 @@ "requires": "", "examples": "" }, + { + "name": "ntp_setLatLong", + "args": "[Latlong]", + "descr": "Sets the NTP latitude and longitude", + "fn": "NTP_SetLatlong", + "file": "driver/drv_ntp.c", + "requires": "", + "examples": "NTP_SetLatlong -34.911498 138.809488" + }, { "name": "ntp_setServer", "args": "[ServerIP]", @@ -1502,6 +1511,15 @@ "requires": "", "examples": "" }, + { + "name": "PWMG_Setup", + "args": "CMD_PWMG_Setup", + "descr": "", + "fn": "NULL);", + "file": "driver/drv_pwm_groups.c", + "requires": "", + "examples": "" + }, { "name": "reboot", "args": "", @@ -2006,6 +2024,15 @@ "requires": "", "examples": "" }, + { + "name": "SPC", + "args": "[Index][RGB]", + "descr": "Sets Palette Color by index.", + "fn": "commandSetPaletteColor", + "file": "cmnds/cmd_newLEDDriver.c", + "requires": "", + "examples": "" + }, { "name": "SPITestFlash_Erase", "args": "CMD_SPITestFlash_Erase", @@ -2324,7 +2351,7 @@ { "name": "toggler_set", "args": "[Value]", - "descr": "Sets the VALUE of given output. Handles toggler_set0, toggler_set1, etc. The last digit after command name is changed to slot index.", + "descr": "Sets the VALUE of given output. Handles toggler_set0, toggler_set1, etc. The last digit after command name is changed to slot index. It can also add to current value if you write value like +25 and subtract if you prefix it with - like -25", "fn": "Toggler_SetX", "file": "driver/drv_pwmToggler.c", "requires": "", diff --git a/docs/json/drivers.json b/docs/json/drivers.json index 238d0cd24..ac7e96f9c 100644 --- a/docs/json/drivers.json +++ b/docs/json/drivers.json @@ -53,6 +53,12 @@ "descr": "BL0942 is a power-metering chip which uses UART protocol for communication. It's usually connected to TX1/RX1 port of BK. You need to calibrate power metering once, just like in Tasmota. See [LSPA9 teardown example](https://www.elektroda.com/rtvforum/topic3887748.html). ", "requires": "" }, + { + "name": "PWMG", + "title": "TODO", + "descr": " ", + "requires": "" + }, { "name": "BL0942SPI", "title": "TODO", diff --git a/docs/json/flags.json b/docs/json/flags.json index ffaa44df7..1f9476045 100644 --- a/docs/json/flags.json +++ b/docs/json/flags.json @@ -313,5 +313,12 @@ "title": "todo", "file": "new_pins.h", "descr": "[HTTP] Disable authentication in safe mode (not recommended)" + }, + { + "index": "45", + "enum": "OBK_FLAG_DISCOVERY_DONT_MERGE_LIGHTS", + "title": "todo", + "file": "new_pins.h", + "descr": "[MQTT Discovery] Don't merge toggles and dimmers into lights" } ] \ No newline at end of file diff --git a/src/driver/drv_ntp.c b/src/driver/drv_ntp.c index 91d93b846..5fd19a0c8 100644 --- a/src/driver/drv_ntp.c +++ b/src/driver/drv_ntp.c @@ -269,11 +269,11 @@ void NTP_Init() { //cmddetail:"examples":""} CMD_RegisterCommand("ntp_setServer", NTP_SetServer, NULL); #if ENABLE_NTP_SUNRISE_SUNSET - //cmddetail:{"name":"ntp_setLatlong","args":"[Latlong]", + //cmddetail:{"name":"ntp_setLatLong","args":"[Latlong]", //cmddetail:"descr":"Sets the NTP latitude and longitude", //cmddetail:"fn":"NTP_SetLatlong","file":"driver/drv_ntp.c","requires":"", //cmddetail:"examples":"NTP_SetLatlong -34.911498 138.809488"} - CMD_RegisterCommand("ntp_setLatLong",NTP_SetLatlong, NULL); + CMD_RegisterCommand("ntp_setLatLong", NTP_SetLatlong, NULL); #endif //cmddetail:{"name":"ntp_info","args":"", //cmddetail:"descr":"Display NTP related settings",