Rule 5.1 Action Editor is blank!

Hi, I've been trying to edit an action in Rule, but suddenly, the editor turns up blank:

The action I'm attempting to edit appears to be ok:
, so what's wrong? I've tried this several times, including after reboot. I'd rather not delete the action as it's a bit complex to reconstruct.

I do get the following log entry: "2022-07-18 03:45:13.342 pm errorjava.lang.NumberFormatException: null on line 5935 (method selectActions)"
How can this be fixed?

Addendum: After tedious delete/reconstruct, I seem to find that attempting to add a line to set a number to a device attribute number results in the 'null' indicated above. No idea why; the device attribute is a number and has a value. In the original Action screen above, the item was entered as the second line after setting the value of 'monthlyEnergy'. It was an attempt to set a monthly cost, so that the values can be written to a local file for review. Setting the cost seemed to cause a 'null' exception, with no way to fix it, other than delete the entire rule.

I have found that when this happens I usually have to just rebuild.

One other option is using a previous backup. Backup your current setup and then roll back to a backup when you know the rule was working. Once loaded, export the rule then reload your current backup.

I had to do this the other day. I try to remember to clone or export a big rule before I try to edit because this does happen from time to time. I decided to make a quick change on a fairly complex rule and I copied and pasted something it did not like and the rule was hosed. Since I didn't take the time to back it up before I started, I had two choices, rebuild or load from a previous backup. This rule was large enough I decided I would rather load a backup.

2 Likes

This problem persists. I'm finding that Rule 5.1 is too buggy to be fully useful. I have had to rebuild the rule every time I use it, and it takes hours to craft.

I have several energy-metering devices, of 3 different types, one a whole-house meter. The types are 1.) Zooz Double Plug, 4 devices; 2.) Zooz Power Switch, 3 instances; 3.) an Aeon Labs HEM 5.

I want an app that will collect the HEM total energy, duration, and calculated cost and write that to a text file, then reset the accumulators.

The HEM has several parameters with a single 'Reset()' method. The Double Plugs have single 'Reset()' method for each. The Power Switch has 'Reset()' methods for Power (min/max), Energy, Current (min.max), and Voltage (min/max). Thus, several methods must be called.

Originally, I tried to schedule this for an automatic reset at 12:01PM on the 17th day of each month, a very tedious trigger to establish. When that worked once and self-destructed, I removed it and later created a virtual button to manually perform the actions.

This latest, with a virtual button, just worked, in that it appended a line to the file, then called the reset methods successfully. However, it then went berserk, just as its ancestors, and could no longer be edited. What's more, it appears to start running is some sort of delayed loop, creating log entries

app:9732022-09-17 07:23:59.944 am errorjava.lang.NumberFormatException: null on line 5935 (method mainPage)

app:9732022-09-17 07:20:06.971 am errorjava.lang.NumberFormatException: null on line 5935 (method mainPage)

app:9732022-09-17 07:18:44.676 am errorjava.lang.NumberFormatException: null on line 5935 (method mainPage)

app:9732022-09-17 07:17:03.784 am errorjava.lang.NumberFormatException: null on line 5935 (method mainPage)

and when I attempt to edit it, the entire app is blank. How can one edit a blank page? I am able to retrieve the json details of the app, which I seem unable to attach here. It's rather large anyway.

Since I can't see the rule, I cannot edit it, nor find the referenced "line 5935". This is not useful. I guess Hubitat is only capable of calling each method manually (17 of them!) to reset energy. Why can't this obvious, glaring editor bug be fixed?

This is why I so despise Javascript in machine control/automation applications!

This has nothing to do with Javascript. I'm not sure what is causing this error specifically, although I will try to find it. It appears that whatever is causing that error hoses up the rule rendering, so you get the blank screen. Not good, needs to be fixed.

Do you know what precipitates the crash? What kind of action? Any more information you could provide would be greatly helpful.

Is your screenshot from the original post indicative? What hub build are you on??

Further: It appears this has something to do with setting a Variable. Do you know what action that might be? Also, your local variable called "monthlyEnergy" is a Number (integer), but the value being assigned to it is floating point. That might be related to this, although not sure about that. Could you try changing these Local Variables to Decimal instead of Number, and see if that clears this problem up? Obviously, even if this is the problem, it should not crash the rule.

Thanks for your reply.

Unfortunately, since I can't edit this, I have no idea what caused the failure. Yes, those original posted images are indicative of the problem as it appears to me.

I'm presently using platform 2.3.2.141. Don't remember what it was when I started this months ago, but I always upgrade as soon as a new release is available. I check frequently during the day as I use the dashboards.

As far as I know, the app rule was editable before I first ran it. When I built it about 2 days prior to using it, it was editable, and I did test some operations as I built it, especially the file append, which I checked and modified a couple of times to get the right format. The only three variables used were working fine at that time. I added, lastly, the actual lines to call the various 'Reset()' methods, which use no passed parameters. I could not test those in advance because I didn't want to reset the accumulators at that time! The same calls have always worked before. I have had to remove the child app because it appeared to have gone rogue, however I did save the json representation before removing it. If it would be useful to you, I can send that.

Yes, I agree that the error seems to indicate a variable problem, but the only variables (three; local to the app) occur with the existing conditions collection before the actual reset. Any other variables are not visible to me. When I did run it by pressing the virtual button once, everything seemed to work, but I saw the error in the log; then it seemed to recur several times, even after it had run and the button was no longer pressed. Not sure why. The file was correctly appended (I can provide the results), and the energy accumulators seem to have been reset correctly. That was when I tried to check the rule to find the referenced line but discovered that I could not view it any longer (this situation has occurred numerous times, as I've attempted this rule at least 5 times now, with similar failures upon each iteration). As to the actual line number indicated, I'm not sure to what "line" numbering the error message is referring, because there were nowhere near even 100 lines in the rule. I must presume the reference is to underlying source code, to which I have no access. Reboot does not seem to help, and I have had to delete and reconstruct the rule each time.

My comment about Javascript is due to my suspicion that the underlying infrastructure is built largely in Javascript. I've experience working with underlying Javascript, and in several cases writing some, to run portions of embedded control systems. In every case there have been problem issues related to the Javascript portions and the inherent behavior of Javascript. It's also a characteristic of Javascript, in my opinion, that it essentially blows up whenever there is what it considers a data type mismatch, as evidenced by the blank screen and the mysterious log error that cannot be traced.

If there is any additional information that you need, I'll be happy to attempt to retrieve it, if possible. There may or may not be some portions in image backups. I saved (downloaded) the last 5 days...

Additional:
The originally posted image of the rule is not what I was just using, and not what generated the error this time. I believe my variables were all 3 decimals, this time, and displayed as I intended them:

2022-09-17: Energy=485.61KWh, Duration=22.8010577546 Days, Cost=$67.99

This is literally the output of the latest iteration of the rule app, and it shows the values that were accumulated before the ultimate reset, so those variables must have been OK. I should have formatted the Duration as well, but obviously didn't.

Correct, and reboot won't cure a bug like this.

This is a UI bug / crash. It's not surprising that it would seemingly do what it was supposed to do, but then fail when you opened it. I'm not sure what would cause that. It's useful information that it started crashing only after having been run

No, the UI uses Javascript but the underlying base is Java. This UI bug has nothing at all to do with Javascript -- it's a plain-jane bug having to do with attempting to transform a supposed number object that isn't a number when the transformation is made, so an error is thrown at a crucial place in the page rendering, hence blank page. Some assumption about a value is wrong, and needs to be checked to protect against this error.

Yeah, this is in line with this being only a UI break. See PM I am sending you.

Please see new PM.

I am not able to reproduce this error. So I'm clueless as to what it is or how to fix it. Most likely thing is something coming from one of the drivers for setting one of the variables from custom attributes. If you could post or send me the driver code, that would help.