ESP Easy Core - Rules and MessageBus

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
FanOfHue
Normal user
Posts: 96
Joined: 06 Oct 2018, 10:08

ESP Easy Core - Rules and MessageBus

#1 Post by FanOfHue » 10 Dec 2018, 19:54

I really like the ESP Easy rule engine because i'm actually a powershell scripting guy. I thought it would be nice to have a small ESP Easy edition with just the rules engine and then try to enhance some rule options from there. I took the Mega Uploader as base, added some code from the last stable R120 and patched some stuff from more recent beta versions.

First results:
  • Strongly reduced program size and RAM usage (350k prog, 38k Free RAM)
  • Still supports OTA single step on 1MB modules
  • Very basic Web gui, just a simple script editor for boot.txt and rules.txt
  • Use plain telnet session for remote debugging
  • Use a simple UDP Messaging Bus for events and sensor data
  • Support named variables for values, string vars and timers
  • All config is done using boot.txt and rules.txt plain text files
Sample boot.txt

Code: Select all

on System#Config do
  Config,WifiSSID,xxxxxx
  Config,WifiKey,yyyyyy
  Config,WifiAPKey,zzzzzz
  Config,Name,Demo-Unit
  Config,Network,192.168.0.150,255.255.255.0,192.168.0.1,192.168.0.1
  Config,DST,0
  Config,Timezone,60
  Config,Baudrate,115200
endon
Sample rules.txt

Code: Select all

on System#Boot do
  setValue Bedroom/Temperature,0,1
  setValue Outdoor/Temperature,0,1
endon

on Bedroom/Room/Temperature do
  setValue Bedroom/Temperature,%eventvalue%
endon

on HueGW/Sensor/Hue temperature sensor 3 do
  setValue Outdoor/Temperature,%eventvalue%
  webprint <h1>Temperature Outdoor:%Outdoor/Temperature%</h1>
endon

User avatar
grovkillen
Core team member
Posts: 3621
Joined: 19 Jan 2017, 12:56
Location: Hudiksvall, Sweden
Contact:

Re: ESP Easy Core - Rules and MessageBus

#2 Post by grovkillen » 11 Dec 2018, 06:07

Cool, you might want to join the ongoing discussion here:

https://github.com/letscontrolit/ESPEasy/pull/1813
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you :idea: :idea: :idea:

FanOfHue
Normal user
Posts: 96
Joined: 06 Oct 2018, 10:08

Re: ESP Easy Core - Rules and MessageBus

#3 Post by FanOfHue » 19 Dec 2018, 15:08

Thanks for the comments, but my idea is not really about rule performance. The main reason for me to build a custom version was to get EVERYTHING rule based. Latest version of my 'core' edition only has a web based textfile editor to edit boot.txt and rules.txt. This can also be called from the file list so you can edit any textfile directly on ESP Easy.

No more saving of binary structs into dat files, just plain text. This makes it possible to even change running config from rules because all is command based.

Might be convenient for ESP Easy stock edition as well.

Post Reply

Who is online

Users browsing this forum: No registered users and 12 guests