ESPEASY

Rules Event reference, Command Reference

Flash a NodeMCU ESP8266 / ESP01S


Send sensor to MQTT broker (tested)

  • At “config” give the ESP a Unit Name
  • Add a controller “Home Assistant (openHAB) MQTT”
    • Fill in the IP address
    • Credentials if used
    • Enable
  • Devices
    • Edit the sensor
    • Enable send to controller (select the MQTT controller)
    • Index number higher than zero, this must be unique for each signal.

ESPEASY P2P network (tested)

  • Both > Config > Unique unit name and unique unit number
  • Both > Controllers > add at #1 a ESPEasy P2P Networking controller
    • portnumber 8266 (both esp the same)
      • Check at Tools > Advanced > ESPEasy p2p UDP port:
    • Make sure it is enabled
    • Both > At the Main page the node list must contain 2 nodes.
  • Both >Hardware no change
  • Go to the 1st ESP
  • Devices > create one wire sensor at task #6 for example
    • refresh rate 5 sec ( not necessary but better than waiting a minute )
    • Send to controller 1
    • Make sure it is enabled
    • Make it working (check devices overview to see a changing value)
  • Go to the 2nd ESP
  • Refresh the devices list and it should appear at task #6
  • Enable the device and adapt the interval

ESP EASY Rules

ESPEASY rules on YouTube

A simple rule to switch on the onboard LED depending of a temperature measurement.

ON OneWireTest#temperature>22 do
gpio,2,0
endon

ON OneWireTest#temperature<21 do
gpio,2,1
endon

ESP EASY rules example


Create a Generic – Dummy Device
– Task 1
– Name it SetPoints
– Enable
– Output Data Type Quad
Submit
Create a 2nd Generic – Dummy Device
– Task 2
– Name it Dummy02
– Enable
– Output Data Type Quad
Submit


Rules > Set fixed numbers over http

// HTTP command > http://<ip_address>/control?cmd=event,SetVar01
On SetVar01 Do
taskvalueset,1,1,10 // Or taskvalueset,SetPoints,1,10
taskvalueset,1,2,20
taskvalueset,1,3,33
taskvalueset,1,4,40
Endon

Result:


Rules > Set variable over http

// HTTP command > http://<ip_address>/control?cmd=event,SetVar02=11,12,13,14
On SetVar02 Do
taskvalueset,1,1,%eventvalue1% // Or taskvalueset,SetPoints,1,%eventvalue1%
taskvalueset,1,2,%eventvalue2%
taskvalueset,1,3,%eventvalue3%
taskvalueset,1,4,%eventvalue4%
Endon

Result:


Rules > Set variable numbers over http with follow up action
// HTTP command > http:///control?cmd=event,SetVar03=11,12,13,14
On SetVar03 Do
taskvalueset,1,1,%eventvalue1% // Or taskvalueset,SetPoints,1,%eventvalue1%
taskvalueset,1,2,%eventvalue2%
taskvalueset,1,3,%eventvalue3%
taskvalueset,1,4,%eventvalue4%
// To initiate followup actions
TaskRun,1 // Or TaskRun,SetPoints
Endon

on SetPoints#Dummy do // Activated by three lines above
if %eventvalue1% < 15.00
// Set a GPIO output
GPIO,2,1
// Set another Dummy Device
taskvalueset,2,1,11
endif
if %eventvalue1% > 15.00
GPIO,2,0
taskvalueset,2,1,10
endif
Endon


Rules > Calculation and variable
// HTTP command > http:///control?cmd=event,SetVar04=12,22,32,42
On SetVar04 Do
Let 1,(%eventvalue1%*3) // Read variable as %v1% or [VAR#1]
taskvalueset,2,2,(%v1%*3)
Endon

Result:


Test a device and set follow-up action

// HTTP command > http:///control?cmd=event,Test01
On Test01 Do
If [SetPoints#Signal01] < 15 //If SetPoints#%eventvalue1% < 15 GPIO,2,0 // Set another Device Signal taskvalueset,2,1,36 endif If [SetPoints#Signal01] > 15
//If SetPoints#%eventvalue1% < 15
GPIO,2,1
// Set another Device Signal
taskvalueset,2,1,37
endif
Endon


ESPEASY Fade in/out

The easy way >htttp://<IP>/control?cmd=PWM,16,450,1000
– 16 is the GPIO pin
– 450 is the intensity endpoint- 1000 is the duration to go to the endpoint.

Fade in/out by script.

On verlichting_ON do
  looptimerset_ms,2,50,20 // Timer 2 / Time in Ms / Number of loops

On Rules#Timer=2 do
  let,2,(%eventvalue2%*15)  // Store the loop count in a variable
  PWM,16,%v2%
Endon


On verlichting_OFF do
  LoopTimerSet,3,5,70
Endon 

On Rules#Timer=3 do
// Take the current value of a device, reduce the value and store it a variable
  let,3,([Plugin#GPIO#Pinstate#3]-%eventvalue2%*15)
// Minimum value is 0
  If %v3% < 0    
    Let,3,0
  Endif
  PWM,3,%v3%
Endon

Plugins

NormalABCDEFGClimateCustom_274Custom_312Custom_IREnergy
0– None –0000000000000
1Switch input – Switch1111111111111
2Analog input – internal2222222222222
3Generic – Pulse counter3333333333333
4Environment – 1-Wire Temperature4444444444444
5Environment – DHT11/12/22  SONOFF2301/7021/MS015555555555
6Environment – BMP085/1806666666666
7Analog input – PCF8591777777777
8RFID – Wiegand888888888
9Switch input – MCP23017999999999
10Light/Lux – BH175010101010101010101010
11Extra IO – ProMini Extender11111111111111111111
12Display – LCD200412121212121212121212
13Position – HC-SR04, RCW-0001, etc.13131313131313131313
14Environment – SI70xx/HTU21D14141414141414141414
15Light/Lux – TSL256115151515151515151515
16Communication – IR Receive (TSOP4838)16
17RFID – PN532171717171717171717
18Dust – Sharp GP2Y1018181818181818181818
19Switch input – PCF857419191919191919191919
20Communication – Serial Server202020202020202020
21Regulator – Level Control21212121212121212121
22Extra IO – PCA9685222222222222222222
23Display – OLED SSD130623232323232323232323
24Environment – MLX9061424242424242424242424
25Analog input – ADS1x1525252525252525252525
26Generic – System Info26262626262626262626262626
27Energy (DC) – INA219272727272727272727272727
28Environment – BMx28028282828282828282828282828
29Output – Domoticz MQTT Helper29292929292929292929292929
30
31Environment – SHT1x31313131313131313131
32Environment – MS5611 (GY-63)32323232323232323232
33Generic – Dummy Device33333333333333333333333333
34Environment – DHT12 (I2C)34343434343434343434
35Communication – IR Transmit35
36Display – OLED SSD1306/SH1106 Framed36363636363636363636363636
37Generic – MQTT Import373737373737373737373737
38Output – NeoPixel (Basic)38383838383838383838
39Environment – Thermosensors39393939393939393939
40RFID – ID12LA/RDM6300404040404040404040
41
42
43Output – Clock43434343434343434343
44Communication – P1 Wifi Gateway44444444444444444444
45Gyro – MPU 605045454545454545454545
46
47Environment – Soil moisture sensor4747474747474747
48Motor – Adafruit Motorshield v248484848484848
49Gases – CO2 MH-Z1949494949494949494949494949
50Color – TCS3472550505050505050
51Environment – AM23205151515151515151
52Gases – CO2 Senseair52525252525252525252525252
53Dust – PMSx003 / PMSx003ST53535353535353535353
54Communication – DMX512 TX54545454545454
55Notify – Chiming55555555555555
56Dust – SDS011/018/19856565656565656565656565656
57Communication – DMX512 TX57575757575757
58Notify – Chiming58585858585858
59Switch Input – Rotary Encoder59595959595959595959
60Analog input – MCP322160606060606060
61Keypad – PCF8574 / MCP23017 / PCF857561616161616161
62Keypad – MPR121 Touch62626262626262
63Keypad – TTP229 Touch636363636363636363
64Gesture – APDS996064646464646464
65Notify – DFPlayer-Mini MP365656565656565
66Color – VEML604066666666666666
67Weight – HX711 Load Cell67
68Environment – SHT3x6868
69Environment – LM75A6969
70Output – NeoPixel Ring Clock70
71Communication – Kamstrup Multical 40171
72Environment – HDC10xx (I2C)7272
73Display – 7-segment display73737373737373737373
74Light/Lux – TSL259174
75Display – Nextion75757575757575
76Energy (AC) – HLW8012/BL093776
77Energy (AC) – CSE776677
78Energy (AC) – Eastron SDMxxx Modbus78
79Motor – Wemos/Lolin Motorshield797979797979797979
80Input – iButton80
81Generic – CRON8181818181818181818181
82Position – GPS82828282828282828282
83Gases – SGP30 TVOC/eCO28383
84UV – VEML607084
85Energy – AccuEnergy AcuDC24x8585
86Generic – Homie receiver86
87Communication – Serial Proxy87
88
89Communication – Ping89898989898989
90Gases – CCS811 TVOC/eCO29090
91Serial MCU controlled switch91
92Heating – DL-Bus (Technische Alternative)92
93Energy (Heat) – Mitsubishi Heat Pump9393
94Communication – CUL Reader94
95
96
97
98Motor – PWM Motor989898
99
100Pulse Counter – DS2423100
101Communication – Wake On LAN101
102Energy (AC) – PZEM-004Tv30-Multiple102
103Environment – Atlas EZO pH ORP EC DO103103
104
105Environment – AHT10/AHT2x105105
106Environment – BME68x106106
107UV – SI1145107
108Energy (AC) – DDS238-x ZN108108
109
110Distance – VL53L0X (200cm)110
111RFID – RC522111
112Color – AS7265X112
113Distance – VL53L1X (400cm)113
114UV – VEML6075 UVA/UVB Sensor114
115Energy – Fuel Gauge MAX1704x115115
116
117Gases – CO2 SCD30117117
118Communication – Itho ventilation118118
119Gyro – ITG3205119
120Accelerometer – ADXL345 (I2C)120
121Position – HMC5883L121
122Environment – SHT2x122122
123
124Output – I2C Multi Relay124
125Accelerometer – ADXL345 (SPI)125
126Output – Shift registers (74HC595)126
127Gases – CO2 CDM7160127127
128
129Input – Shift registers (74HC165)129
130
131
132Energy (DC) – INA3221132
133UV – LTR390133133
134Distance – A02YYUW134
135Gases – CO2 SCD4x135135
136
137
138
139
140
141
142
143Switch input – I2C Rotary encoders143
144Dust – PM1006(K) (Vindriktning)144144
145Gases – MQxxx (MQ135 CO2, MQ3 Alcohol) [TESTING]145
146Generic – Cache Reader146146
147Gases – SGP4x VOC(/NOx)147147
148
149
150Environment – TMP117 Temperature150150
151Environment – I2C Honeywell Pressure151151
152
153Environment – SHT4x153153