mirror of https://github.com/arendst/Tasmota.git
Updated Rules (markdown)
parent
1d51be90c0
commit
232a0294bc
50
Rules.md
50
Rules.md
|
@ -240,7 +240,7 @@ See example 5 [below](Rules#5-use-of-variables-and-tele-).
|
|||
|
||||
The following examples will explain some use cases.
|
||||
|
||||
[1. Prevent Wemos D1 mini load overcurrent](Rules#1-prevent-wemos-d1-mini-load-overcurrent)
|
||||
[1. Use long press action on a switch](Rules#1-use-long-press-action-on-a-switch)
|
||||
|
||||
[2. Execute any MQTT message when a button is pressed](Rules#2-execute-any-mqtt-message-when-a-button-is-pressed)
|
||||
|
||||
|
@ -291,30 +291,21 @@ The following examples will explain some use cases.
|
|||
|
||||
[22. Invoking rules using clock timer to control a luminance-triggered switch only in mornings](Rules#22-invoking-rules-using-clock-timer-to-control-a-luminance-triggered-switch-only-in-mornings)
|
||||
|
||||
[23. Prevent Wemos D1 mini load overcurrent](Rules#1-prevent-wemos-d1-mini-load-overcurrent)
|
||||
[BackToTop](Rules#summary)
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
#### 1. Prevent Wemos D1 mini load overcurrent
|
||||
As a WS2812 24 led ring draws approximately 24x3x20 mA = 1.44A and the Wemos D1 mini powered from a PC's USB port can only provide up to 0.5A it would be nice to have some kind of mechanism in place to limit the amount of current to the WS2812 LEDring to 0.1A. This is still enough to light all 24 leds up to color 202020.
|
||||
|
||||
Hardware
|
||||
- Wemos D1 mini
|
||||
- INA219 I2C sensor
|
||||
- WS2812 LEDring with 24 LEDs powered by the Wemos D1 mini 5V thru the INA219 sensor
|
||||
|
||||
Software
|
||||
- Sonoff-Tasmota with define USE_RULES enabled
|
||||
|
||||
Rule
|
||||
- ``on INA219#Current>0.100 do Backlog Dimmer 10;Color 10,0,0 endon``
|
||||
|
||||
Result
|
||||
- When a user raises brightness to a level using more than 0.1A the rule kicks in and lowers the current by executing command ``Dimmer 10`` and changes the color to Red with command ``Color 10,0,0``.
|
||||
|
||||
|
||||
[BackToExamples](Rules#examples)
|
||||
#### 1. Use long press action on a switch
|
||||
|
||||
Activate long press action with `Switchmode 5` first and shorten long press time to 2 seconds.
|
||||
Long pressing on switch1 sends `POWER TOGGLE` command to the `sonoff02` device
|
||||
```
|
||||
SwitchMode 5
|
||||
SetOption32 20
|
||||
Rule on switch1#state=3 do cmnd/sonoff02/POWER 2 endon
|
||||
Rule 1
|
||||
```
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
#### 2. Execute any MQTT message when a button is pressed
|
||||
|
@ -1213,5 +1204,24 @@ Rule2 1
|
|||
```
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
#### 23. Prevent Wemos D1 mini load overcurrent
|
||||
As a WS2812 24 led ring draws approximately 24x3x20 mA = 1.44A and the Wemos D1 mini powered from a PC's USB port can only provide up to 0.5A it would be nice to have some kind of mechanism in place to limit the amount of current to the WS2812 LEDring to 0.1A. This is still enough to light all 24 leds up to color 202020.
|
||||
|
||||
Hardware
|
||||
- Wemos D1 mini
|
||||
- INA219 I2C sensor
|
||||
- WS2812 LEDring with 24 LEDs powered by the Wemos D1 mini 5V thru the INA219 sensor
|
||||
|
||||
Software
|
||||
- Sonoff-Tasmota with define USE_RULES enabled
|
||||
|
||||
Rule
|
||||
- ``on INA219#Current>0.100 do Backlog Dimmer 10;Color 10,0,0 endon``
|
||||
|
||||
Result
|
||||
- When a user raises brightness to a level using more than 0.1A the rule kicks in and lowers the current by executing command ``Dimmer 10`` and changes the color to Red with command ``Color 10,0,0``.
|
||||
|
||||
|
||||
[BackToExamples](Rules#examples)
|
||||
|
||||
[BackToTop](Rules#summary)
|
Loading…
Reference in New Issue