Here is my method for debugging RULEs while I'm developing and I hope it helps some people out.
First thing is to add a 'Generic - Dummy Device', name it 'data' and name one of the variables 'debug'. For our example, let's assume you select device 12 and named the first variable 'debug' .
Now in your rules just add anywhere you want
TaskValueSet,11,1,n.m // debug
I suggest if you have more than one 'on xxxxx do' use 1.m for the first on/do, 2.m for the second etc. In addition change m for each debug spot. As the rules fire, the variable will change telling you where you are. It's really helpful when your rules do what you told them to do, not want them to do.
Or in other words, things just don't work and you don't know why. This will at least tell you the last part of the rule that worked.
Here is an example from a ruleset I use
==============
on dataReq do
TaskValueSet,12,1,1.1 // debug <<<<<<<<<<<<<<<<<
TaskValueSet,12,1,%eventvalue1% // set rxGroupID from received message
TaskValueSet,12,2,%eventvalue2% // set rxNodeID from received message
TaskValueSet,12,3,%eventvalue3% // set requesterID from received message
// is this a 'all' group or a requset for my group
if [rx#rxGroupID] = [my#groupID] or [rx#rxGroupID] = 0
TaskValueSet,12,1,1.2 // debug <<<<<<<<<<<<<<<<<
event checkNode // yes go check node requested
endif
endon
on checkNode do
TaskValueSet,12,1,2.1 // debug <<<<<<<<<<<<<<<<<
// is this a 'all' nodes or a request for my node
if [rx#rxNodeID] = [my#nodeID] or [rx#rxNodeID] = 0
TaskValueSet,12,1,2.2 // debug <<<<<<<<<<<<<<<<<
event sendData // yes go send the data
endif
endon
==============
How to DEBUG your RULES
Moderators: grovkillen, Stuntteam, TD-er
- dynamicdave
- Normal user
- Posts: 257
- Joined: 30 Jan 2017, 20:25
- Location: Hampshire, UK
Re: How to DEBUG your RULES
What a clever idea.
It will be extremely useful in developing some of my Rule-Sets.
Thanks for sharing.
It will be extremely useful in developing some of my Rule-Sets.
Thanks for sharing.
-
- New user
- Posts: 1
- Joined: 06 Apr 2019, 21:42
Re: How to DEBUG your RULES
What a great idea?!
I luve it! Very useful!
Thank for sharing
I luve it! Very useful!
Thank for sharing
"Believe in the spirit of love, it can heal all things!"
Download granny 2.0
Download granny 2.0
Who is online
Users browsing this forum: No registered users and 42 guests