rules issue >#1

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
obod0002c
Normal user
Posts: 119
Joined: 10 Aug 2019, 20:31

rules issue >#1

#1 Post by obod0002c » 16 Feb 2023, 18:02

certainly a beginner's mistake, but I can't get it to work:

Excerpt from rules section:

Code: Select all

On AlphaEss#solarPLUS=1 Do      // tried without '=1', no change
  GPIO,16,1
  If [AlphaEss#solarPLUS]=1 And [Heating#isAllowed]=1
    If %systime% > 14:00:00 And [tempIs_THR320D_No1#hwtank] < 55.0
      GPIO,16,1
    Endif
  Endif  
Endon
Device's tab:
device.png
device.png (13.48 KiB) Viewed 1024 times

Result:

Code: Select all

153769563: HTTP: taskvalueset,6,1,0
153770097: static_file: /favicon.ico
153778426: HTTP: taskvalueset,6,1,1
153778970: static_file: /favicon.ico
153787406: WD : Uptime 2563 ConnectFailures 0 FreeMem 210032 WiFiStatus WL_CONNECTED 3 ESPeasy internal wifi status: Conn. IP Init
153802629: EVENT: Clock#Time=Thu,17:52

With On Clock.., / On Rules.., no trouble.
No spaces before/after the device's names.

User avatar
Ath
Normal user
Posts: 3480
Joined: 10 Jun 2018, 12:06
Location: NL

Re: rules issue >#1

#2 Post by Ath » 16 Feb 2023, 19:35

You can try to execute the event yourself by typing "event,AlphaEss#solarPLUS=1" on the Tools page. That should start the eventhandler. And you can also add LogEntry statements to see the actual values of the variables.
Not sure why the gpio,16,1 command is there as the first line in the eventhandler, I assume it's there to get at least some response.
/Ton (PayPal.me)

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

Re: rules issue >#1

#3 Post by TD-er » 16 Feb 2023, 21:21

It is a dummy task, which isn't executed by itself.
You have to call "taskrun" on the dummy task.
Also check if you checked the checkbox on the config page of this Dummy task to see if you selected to send all values in a single event.
If you did, then the event would be like "taskname#All"

obod0002c
Normal user
Posts: 119
Joined: 10 Aug 2019, 20:31

Re: rules issue >#1

#4 Post by obod0002c » 17 Feb 2023, 23:53

Didn't get it, sorry.

1.
AlphaEss#solarPLUS is set by external device:
SendTo 11,"TaskValueSet 4,1,[tempIs#hwtank]"

2.
Just wanted to test it using browser:
.../control?cmd=taskvalueset,6,1,1

Will 1. work and execute what's between On..Endon?
How to fire for test? ../control?cmd=taskrun,6?

Maybe I mix variables/dummy devices and tasks .. but how to run a task automatically when a variable/dummy device changes?

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

Re: rules issue >#1

#5 Post by TD-er » 18 Feb 2023, 00:10

I think by far the easiest (and safest) way is to send an event, with a few eventvalues.
Then on the receiving end, where you set the value(s) to a dummy task, you can immediately execute something that needs to be done.

So from a remote host, you can send something like this:

Code: Select all

SendTo 11,"event,`MyEvent=4,1,[tempIs#hwtank]`"
Note the different quotes wrapping the event and its eventvalues, since we need to have a comma as separator in the event itself and we need the argument for SendTo also to be wrapped in quotes.

Then in the rules on the receiving node:

Code: Select all

on MyEvent do
  TaskValueSet,%eventvalue1%,%eventvalue2%,%eventvalue3%
  // Do whatever you need to do immediately after setting your value
endon

obod0002c
Normal user
Posts: 119
Joined: 10 Aug 2019, 20:31

Re: rules issue >#1

#6 Post by obod0002c » 19 Feb 2023, 17:41

Thx for that clarification.
Looks like I had understood the On .. Endon completely wrong initially :cry:

It works, and it creates a lot less log entries .. which I believe is intended and good for the device's memory write cycles.

Post Reply

Who is online

Users browsing this forum: Google [Bot] and 5 guests