difference for rules notation in different esp versions

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
BartSr
Normal user
Posts: 122
Joined: 27 Sep 2019, 17:45

difference for rules notation in different esp versions

#1 Post by BartSr » 21 Jun 2023, 11:49

Hi,
I had working rulesset on ESP BinFile ESP_Easy_mega_20211224_normal_ESP8266_4M1M

Code: Select all


Rules Set 1

on System#Boot do
  loopTimerSet,1,10
  loopTimerSet,2,2
endon


on Rules#Timer=2 do

 if [Plugin#GPIO#Pinstate#14]=0 //D5
	sendto, 2, "gpio 16,1"
 endif

 if [Plugin#GPIO#Pinstate#14]=1
	sendto, 2, "gpio 16,0"
 endif
	
endon

on Rules#Timer=1 do
  sendto,2,"timerset,1,10"
endon 
now I want to transfer this to other ESP
BinFile ESP_Easy_mega_20201227_normal_ESP8266_4M1M

But now there must be used other way of putting code in starting with Event Name

Can pls advise how to convert?
TIA
-Bart

TD-er
Core team member
Posts: 8756
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: difference for rules notation in different esp versions

#2 Post by TD-er » 21 Jun 2023, 12:07

You are moving rules from a newer ESPEasy version to an older one.
I suspected the looptimer wasn't available in that older build, but apparently it was
See: https://espeasy.readthedocs.io/en/lates ... oop-timers

So the only thing I can think of here is to format the rules a bit to remove extra spaces in command parsing and put the first line in a comment:

Code: Select all


// Rules Set 1

on System#Boot do
  loopTimerSet,1,10
  loopTimerSet,2,2
endon


on Rules#Timer=2 do

 if [Plugin#GPIO#Pinstate#14]=0 //D5
    sendto,2,"gpio 16,1"
 endif

 if [Plugin#GPIO#Pinstate#14]=1
    sendto,2,"gpio 16,0"
 endif
    
endon

on Rules#Timer=1 do
  sendto,2,"timerset,1,10"
endon 

Post Reply

Who is online

Users browsing this forum: No registered users and 42 guests