Skip to content
btsimonh edited this page Nov 1, 2022 · 6 revisions

Console Commands

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 Arguments Description
setChannel [ChannelIndex][ChannelValue] Sets a raw channel to given value. Relay channels are using 1 and 0 values. PWM channels are within [0,100] range. Do not use this for LED control, because there is a better and more advanced LED driver with dimming and configuration memory (remembers setting after on/off), LED driver commands has "led_" prefix.
addChannel [ChannelIndex][ValueToAdd][ClampMin][ClampMax] Ads a given value to the channel. Can be used to change PWM brightness. Clamp min and max arguments are optional.
setPinRole [PinRole][RoleIndexOrName] qqq
setPinChannel [PinRole][ChannelIndex] qqq
addRepeatingEvent [IntervalSeconds][RepeatsOr-1][CommandToRun] Starts a timer/interval command. Use "backlog" to fit multiple commands in a single string.
addEventHandler [EventName][EventArgument][CommandToRun] This can be used to trigger an action on a button click, long press, etc
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"
sendGet [TargetURL] Sends a HTTP GET request to target URL. May include GET arguments. Can be used to control devices by Tasmota HTTP protocol.
publish [Topic][Value] Publishes data by MQTT. The final topic will be obk0696FB33/[Topic]/get
linkTuyaMCUOutputToChannel TODO Used to map between TuyaMCU dpIDs and our internal channels. Mapping works both ways.
tuyaMcu_setBaudRate [BaudValue] Sets the baud rate used by TuyaMCU UART communication. Default value is 9600.
led_enableAll [1or0] Power on/off LED but remember the RGB(CW) values.
led_basecolor_rgb [HexValue] Puts the LED driver in RGB mode and sets given color.
led_basecolor_rgbcw [HexValue] TODO
led_temperature [TempValue] Toggles LED driver into temperature mode and sets given temperature. It using Home Assistant temperature range (in the range from 154-500 defined in homeassistant/util/color.py as HASS_COLOR_MIN and HASS_COLOR_MAX)
led_dimmer [DimmerValue] Used to dim all kinds of lights, works for both RGB and CW modes.
led_brightnessMult [Value] Internal usage only.
led_colorMult [Value] TODO
led_saturation [Value] This is an alternate way to set the LED color.
led_hue [Value] This is an alternate way to set the LED color.
SM2135_Map [Ch0][Ch1][Ch2][Ch3][Ch4] Maps the RGBCW values to given indices of SM2135 channels. This is because SM2135 channels order is not the same for some devices. Some devices are using RGBCW order and some are using GBRCW, etc, etc.
SM2135_RGBCW [HexColor] Don't use it. It's for direct access of SM2135 driver. You don't need it because LED driver automatically calls it, so just use led_basecolor_rgb
BP5758D_Map [Ch0][Ch1][Ch2][Ch3][Ch4] Maps the RGBCW values to given indices of BP5758D channels. This is because BP5758D channels order is not the same for some devices. Some devices are using RGBCW order and some are using GBRCW, etc, etc.
BP5758D_RGBCW [HexColor] Don't use it. It's for direct access of BP5758D driver. You don't need it because LED driver automatically calls it, so just use led_basecolor_rgb
restart Reboots the device.
clearConfig Clears all the device config and returns it to AP mode.
VoltageSet [Value] Used for BL0942/BL0937/etc calibration. Refer to BL0937 guide for more info.
PowerSet [Value] Used for BL0942/BL0937/etc calibration. Refer to BL0937 guide for more info.
CurrentSet [Value] Used for BL0942/BL0937/etc calibration. Refer to BL0937 guide for more info.
DGR_SendPower [GroupName][ChannelValues][ChannelsCount] Sends a POWER message to given Tasmota Device Group with no reliability. Requires no prior setup and can control any group, but won't retransmit.
DGR_SendBrightness [GroupName][Brightness] Sends a Brightness message to given Tasmota Device Group with no reliability. Requires no prior setup and can control any group, but won't retransmit.
lfssize Log the current in-use and configures size of the LFS flash.
lfssize [size] Set the configured LFS flash size and Log the current in-use and configures size of the LFS flash.
lfsmount mount the LFS filesystem.
lfsunmount unmount the LFS filesystem.
lfsformat unmount, format and re-mount LFS filesystem.
lfsformat [size] Set the configured LFS flash size, unmount, format and re-mount LFS filesystem. e.g. lfsformat 0x10000
startdriver DRVERNAME start a driver by name. e.g. startdriver SSDP
stopdriver DRVERNAME stop a driver by name. e.g. stopdriver IR

Console Command Examples

Command Description
addRepeatingEvent 15 -1 SendGet http://192.168.0.112/cm?cmnd=Power0%20Toggle This will send a Tasmota HTTP Toggle command every 15 seconds to given device
addEventHandler OnClick 8 SendGet http://192.168.0.112/cm?cmnd=Power0%20Toggle This will send a Tasmota HTTP Toggle command to given device when a button on pin 8 is clicked (pin 8, NOT channel 8)
addChangeHandler Channel1 != 0 SendGet http://192.168.0.112/cm?cmnd=Power0%20On This will set a Tasmota HTTP Power0 ON command when a channel 1 value become non-zero
addChangeHandler Channel1 == 0 SendGet http://192.168.0.112/cm?cmnd=Power0%20Off This will set a Tasmota HTTP Power0 OFF command when a channel 1 value become zero
addChangeHandler Channel1 == 1 addRepeatingEvent 60 1 setChannel 1 0 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?
startdriver SSDP This will start the SSDP driver - your T or N device will appear in Windows Networking as an 'Other Device'

Console Command argument expansion

Every console command that takes an integer argument supports following constant expansion:

  • $CH[CHANNEL_NUMBER] - so, $CH0 is a channel 0 value, etc, so SetChannel 1 $CH2 will get current value of Channel2 and set it to Channel 1