Commit Graph

53 Commits

Author SHA1 Message Date
Adrian Scillato 4fcbaf99be
Add variable %timestamp% to be used in rules
This PR adds a new variable %timestamp% to be used in a rule to allow the user to include the Time Stamp as Tasmota has for Status, Sensors, etc, for example:

Command:

publish stat/topic/sensor {"Time":"%timestamp%","mysensor":"%var1%"}

Output:

{"Time":"2018-12-27T12:52:57","mysensor":"1"}

(https://github.com/arendst/Sonoff-Tasmota/issues/4734)
2018-12-27 14:57:27 -03:00
Theo Arends c1102a4863 6.4.0.2 Fix possible dtostrf bos
6.4.0.2 20181221
 * Fix possible dtostrf buffer overflows by increasing buffers
2018-12-21 16:17:06 +01:00
Adrian Scillato c68fe7e7ad
RULES: Added BREAK as an alternative ENDON 2018-12-01 19:00:34 -03:00
Adrian Scillato 7f2b3643f5
RULES: Added BREAK as an alternative ENDON
RULES: Added BREAK as an alternative ENDON that will stop the execution of the following rules.

If a rule that ends with BREAK, is triggered, then the following rules of that set will not be executed. This is useful for cases like: https://github.com/arendst/Sonoff-Tasmota/issues/4477
2018-12-01 18:12:33 -03:00
Adrian Scillato e3d1971e51
Add Command CalcRes 2018-11-26 23:08:23 -03:00
Adrian Scillato f7a8f39f89
Added command CalcRes 2018-11-26 21:22:44 -03:00
Erik bee50cba06 Add support for sensor discovery 2018-11-21 19:21:51 +01:00
andrethomas 4a7e7b0dbb Change C functions with () to (void) 2018-11-14 15:32:09 +02:00
Theo Arends 9fef82736d Prep drivers for management
Prep drivers for management
2018-11-07 10:30:03 +01:00
Adrian Scillato bcc9432214
Added Dimmer Trigger for Rules
For example

rule on Dimmer#state<30 do ... endon
rule on Dimmer#boot<10 do ... endon
2018-10-01 13:13:47 -03:00
Adrian Scillato a67efa0ab2
Added new triggers for rules on boot time
To make it possible to trigger a rule at boot time with the state of the switches or relays (in order to take decisions), 2 new trigger types has been added: 

* SWITCH1#BOOT

to be used like:

ON SWITCH1#BOOT DO ...  %value% ENDON
ON SWITCH1#BOOT=0 DO .... ENDON
ON SWITCH1#BOOT=1 DO .... ENDON

and

* POWER1#BOOT

to be used like:

ON POWER1#BOOT DO ...  %value% ENDON
ON POWER1#BOOT=0 DO .... ENDON
ON POWER1#BOOT=1 DO .... ENDON
2018-09-26 23:02:55 -03:00
Theo Arends 6939d6eead Fix Shelly Ghost and Rule sensors
* Change pinmode for no-pullup defined switches to pullup when configured as switchmode PUSHBUTTON (=3 and up) (#3896)
 * Add delay after restart before processing rule sensor data (#3811)
2018-09-26 11:56:58 +02:00
Theo Arends 01ce1b0c91 Fix Shelly2 monitoring
Disable serial logging on Shelly2 as serial is being used by energy monitoring (#3878)
2018-09-23 13:55:42 +02:00
Theo Arends f05fc71d67 Fix rule trigger POWER1#STATE
Fix rule trigger POWER1#STATE execution after restart and SetOption0 is 0 (#3856)
2018-09-22 17:37:49 +02:00
Theo Arends 7cd9224819 6.2.1.3 - Change drop down list
6.2.1.3 20180907
 * Change web Configure Module GPIO drop down list order for better readability
 * Fix showing Period Power in energy threshold messages
 * Fix ButtonRetain to not use default topic for clearing retain messages (#3737)
2018-09-08 17:18:31 +02:00
Theo Arends 55b43734d8 6.1.1.13 - Fixes
6.1.1.13 20180828
 * Fix 6.1.1.12 regression of Mem and Var default handling (#3618)
 * Optimizations
2018-08-28 11:10:32 +02:00
Theo Arends f8666c0410 Some requested additions
* Add optional MQTT_TELE_RETAIN to Energy Margins message (#3612, 3614)
 * Add Individual HSBColorX commands (#3430, #3615)
 * Add RuleX debug options 8,9,10 (StopOnError) to control RuleX execution status after an exception restart (#3607)
2018-08-28 10:26:33 +02:00
Theo Arends d4931f7b11 Fix handling default names Pt.2
Fix handling default names Pt.2
2018-08-27 14:53:09 +02:00
Theo Arends 9978381c94 Fix handling deafult names
Fix handling use of default names when using names starting with shortcut character (#3392, #3600)
2018-08-27 13:06:22 +02:00
Adrian Scillato f70e4ab783
Added time parameters as variable comparison
Added %sunrise%, %sunset%, %uptime% and %time% to be used in rules comparison like:

on Time#Initialized do backlog event checksunrise=%time%; event checksunset=%time% endon
on event#checksunset>%sunset% do power3 1 endon
on event#checksunrise<%sunrise% do power3 1 endon
2018-08-27 04:59:17 -03:00
Theo Arends bbd2529914 Sleep fixes part 2 and 3 of 3
* Change scheduler phase 2/3 - Fixed when sleep is enabled: Blinktime (#3581)
 * Change scheduler phase 3/3 - Some sensor update timings: AdcEvery 200 -> 250, Senseair 300 -> 250, SDM120 300 -> 250, SDM630 300 -> 250
2018-08-26 17:10:18 +02:00
Theo Arends f090050e69 6.1.1.11 - Sleep fixes part 1
6.1.1.11 20180826
 * Change scheduler phase 1 - Fixed when sleep is enabled: Uptime, Delay, PulseTime and TelePeriod (#3581)
2018-08-26 15:42:35 +02:00
Theo Arends b34874ba45 Add all ruletimer values
Add all ruletimer values to command RuleTimer result message (#3571)
2018-08-24 18:22:04 +02:00
Theo Arends 6a5c0d29e8 6.1.1.9 - Fixes and Additions
6.1.1.9
 * Allow user override of define MAX_RULE_TIMERS (#3561)
 * Allow user override of define MAX_RULE_VARS
 * Add GPIO options ButtonXn, SwitchXn and CounterXn to select INPUT mode instead of INPUT_PULLUP (#2525)
 * Fix OtaMagic when file path contains a dash (-) (#3563)
2018-08-23 16:05:51 +02:00
Theo Arends 8a61c25218 6.1.1.6 Add modulo option to rules
Add modulo option to rules like rule1 on Time#Minute|5 do backlog power on;delay 200;power off endon (#3466)
2018-08-13 13:09:22 +02:00
Theo Arends cc5b0aaf90 Add option + to command Rule
Add option + to command Rule to concatenate new rule with existing rules (#3365)
2018-07-29 14:45:42 +02:00
Theo Arends da7dadae21 Add rule triggers
Add rule triggers Wifi#Connected and Wifi#Disconnected (#3359)
2018-07-28 15:06:31 +02:00
Adrian Scillato 96fb23737d
Move subStr Function to Support.ino 2018-07-23 01:29:50 -03:00
Theo Arends 9ef10f24d2 Fix command Scale buffer overflow
Fix command Scale buffer overflow (#3236)
2018-07-16 12:37:49 +02:00
Theo Arends b56961c528 Fix rules once regression
Fix rules once regression from v6.1.0 (#3198, #3226)
2018-07-16 11:34:44 +02:00
Adrian Scillato 27ddbb0609
Added decimal values support for commands ADD, SUB, MULT and SCALE 2018-06-28 13:06:21 -03:00
Theo Arends 20a53950ff Fix possible wifi connection problem
Fix possible wifi connection problem (#1366)
2018-06-28 12:25:50 +02:00
Theo Arends 862623b295 Add rule variables and add minutes
6.0.0a
* Add time in minutes to rule Time#Initialized, Time#set and Time#Minute
(#2669)
* Add rule variables %time% for minutes since midnight, %uptime%,
%sunrise% and %sunset% giving time in minutes (#2669)
2018-06-26 16:22:53 +02:00
Theo Arends dc1c2abda7 Add heap and stack debug information
Add heap and stack debug information
2018-06-26 11:48:09 +02:00
Theo Arends e818f0da55 Fix rules induced LWT message
Fix rules induced LWT message
2018-06-25 18:00:20 +02:00
Adrian Scillato f45dd53352
Add Arithmetic commands for VAR
New Arithmetic commands to be used with VARs:

ADD1 to ADD5: Add a value to VAR[x]
Usage: ADD1 15
Result: VAR1 = VAR1 + 15

SUB1 to SUB5: Substract a value from VAR[x]
Usage: SUB1 15
Result: VAR1 = VAR1 - 15

MULT1 to MULT5: Multiply a value to VAR[x]
Usage: MULT1 15
Result: VAR1 = VAR1 * 15

SCALE1 to SCALE5: Scale a value from a low and high limit to another low and high limit and store it in VAR[x] (directly equivalent to MAP arduino command)

Syntax: 
SCALEx value, fromLow, fromHigh, toLow, toHigh

Parameters
value: the number to scale

fromLow: the lower bound of the value’s current range

fromHigh: the upper bound of the value’s current range

toLow: the lower bound of the value’s target range

toHigh: the upper bound of the value’s target range

(omitted values are taken as zero)

Usage: SCALE1 15, 0, 100, 0, 1000
Result: VAR1 = 150
2018-06-10 02:09:11 -03:00
Theo Arends d4119fe54d Add SnfBrdg EFM8BB1 fw tools
6.0.0a
* Add support for uploading Sonoff Bridge firmware found in
tools/fw_efm8bb1 folder build by Portisch using Web Gui File Upload
(#2886)
* Add command RfRaw to control Portisch firmware features
2018-06-04 18:10:38 +02:00
Theo Arends f3c4001b4a Fix HWRestart on rule event
5.14.0b
* Fix Hardware Watchdog restart when using event command (#2853)
2018-05-29 17:24:42 +02:00
Theo Arends ed56322f12 Add command source information
5.14.0b
* Add source information to command execution to be shown with logging
option 3 (#2843)
2018-05-28 15:52:42 +02:00
Theo Arends d1db31fc0a Fix rule string comparison 2018-05-24 17:08:14 +02:00
Theo Arends 9f329d5fb0 Add rule support for IrReceive and RfReceive
5.14.0b
 * Add rule support for IrReceive and RfReceive (#2758)
2018-05-24 16:23:20 +02:00
Theo Arends ca08b77aad Add two more rule sets
5.14.0b
 * Increase rule storage space to 3 rule sets of 512 characters
using commands rule1, rule2 and rule3
2018-05-24 14:25:52 +02:00
Theo Arends 06258e5a68 Rules fixes and additions
5.14.0a
* Add rules %mem1% to %mem5% variable names storing data in flash
(#2780)
* Add rules test on %varx% or %memx% (#2780)
* Fix anomalies in rules (#2778)
2018-05-20 17:46:00 +02:00
Adrian Scillato 65985dc35f
Fix 'vars' on Rules
The 'vars' was not working from one rule to another because the declaration of the variable was not global and was being lost.
2018-05-19 03:00:48 -03:00
Theo Arends a6e0156576 Add SetOption16 Power legacy/indexed mode
5.13.1a
* Add SetOption26 to enforce use of indexes even when only one relay is
present (#1055)
2018-05-13 17:38:44 +02:00
Theo Arends 016b1dd029 Optimize command handling
Optimize command handling
2018-05-09 10:49:43 +02:00
Theo Arends d935004e4a Fix rule backlog issue and add On/Off test
5.13.1a
* Fix rule power trigger when no backlog command is used (#2613)
* Add rule state test for On/Off in addition to 0/1 (#2613)
2018-05-06 16:07:42 +02:00
Theo Arends d629b8ce2a v5.13.0a - Fix JSON buffer size
5.13.0a
 * Fix JSON buffers size too small for execution in some
situations (#2580)
2018-05-01 11:28:36 +02:00
Theo Arends 4675dbea1c Add rules variables and teleperiod trigger
5.12.0m
* Add rule variables and teleperiod trigger to accomodate user HA
messages
2018-04-27 18:06:19 +02:00
Theo Arends f9c702f8eb v5.12.0m - Add MQTT_TELE_RETAIN
5.12.0m
* Add define MQTT_TELE_RETAIN compile option default set to 0 (#1071)
2018-04-25 12:06:53 +02:00