Plugin_read from rules? / Water sensor problem

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
User avatar
enesbcs
Normal user
Posts: 587
Joined: 18 Jun 2017, 11:02
Location: Békéscsaba, Hungary
Contact:

Plugin_read from rules? / Water sensor problem

#1 Post by enesbcs » 09 Jan 2018, 09:32

Are there any option to call "PLUGIN_READ" function from a plugin, or i have to extend the specific plugin with a PLUGIN_WRITE to make it work?

I am trying to use a 3pin simple water sensor. (+/-/S) I've connected the analog "S" to an ESP8266 A0 pin, the "+" to ESP D8 pin, and the "-" to GND. My purpose is to powering the device with D8 pin (HIGH) in every 60-120sec, and i have to force the ADC plugin somehow to do AnalogRead only if D8=1. After the successful read, D8 goes to LOW (cut device power to reduce corrosion) and until D8=0 there are no need to do AnalogRead.

If i try to use the ADC plugin generated rule event to change D8 state, then it reads analog 0 value before D8=1. Anyone using this kind of water sensor?
Image

User avatar
enesbcs
Normal user
Posts: 587
Joined: 18 Jun 2017, 11:02
Location: Békéscsaba, Hungary
Contact:

Re: Plugin_read from rules? / Water sensor problem

#2 Post by enesbcs » 11 Jan 2018, 21:27

enesbcs wrote: 09 Jan 2018, 09:32 Are there any option to call "PLUGIN_READ" function from a plugin, or i have to extend the specific plugin with a PLUGIN_WRITE to make it work?
If anyone interested there are a currently undocumented command in ESPEasy Mega "taskrun" it takes one parameter, then task number to run, and it works flawlessly, triggering the PLUGIN_READ from Rules at the specific task immediately. I've found it accidentally while i inspecting command.ino. :) Whoever code it, big thanks!

AndrewJ
Normal user
Posts: 229
Joined: 14 Feb 2017, 12:38

Re: Plugin_read from rules? / Water sensor problem

#3 Post by AndrewJ » 12 Jan 2018, 09:42

This sounds interesting. I'll have a play!

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

Re: Plugin_read from rules? / Water sensor problem

#4 Post by TD-er » 12 Jan 2018, 15:34

enesbcs wrote: 11 Jan 2018, 21:27
enesbcs wrote: 09 Jan 2018, 09:32 Are there any option to call "PLUGIN_READ" function from a plugin, or i have to extend the specific plugin with a PLUGIN_WRITE to make it work?
If anyone interested there are a currently undocumented command in ESPEasy Mega "taskrun" it takes one parameter, then task number to run, and it works flawlessly, triggering the PLUGIN_READ from Rules at the specific task immediately. I've found it accidentally while i inspecting command.ino. :) Whoever code it, big thanks!
Hmm if it is undocumented, we should do something about it :)

Sounds like a nice enough feature to use in other scripts also.

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

Re: Plugin_read from rules? / Water sensor problem

#5 Post by grovkillen » 12 Jan 2018, 15:39

I will try to document that this weekend. Super thanks for skimming through the code. :)
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:

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

Re: Plugin_read from rules? / Water sensor problem

#6 Post by grovkillen » 12 Jan 2018, 23:57

This is a great thing actually, you can use it to publish other devices on a given trigger. Especially with rules this is pretty nice!

Great find and thank you for letting us know about it.

On my read through the command.ino I also found TaskClear which let you delete a given task (no need to go into the settings menu anymore). And also the "rules" which let you turn on or off the rules page. Simple yet come in hand since I use HTTP in the current ESP Easy Flasher to activate rules.. no need for that anymore :)

These three "new" commands are now listed here: https://www.letscontrolit.com/wiki/inde ... _Reference
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:

Post Reply

Who is online

Users browsing this forum: No registered users and 32 guests