Rule Machine Error - NumberFormatExceptoin

I have been working on modifying a driver for a AEON Meter to include attributes for each clamp. After working on this for awhile, I started getting an error when attempting to modify a rule that is testing one of my custom attributes.

I am running C7, version I ended up deleting the rule and am now trying to recreate the rule but still am getting the same error.

I even deleted (unpaired) and repaired the device but still am getting the same error when trying to create the rule.

Create a new rule/name
Select Trigger Events
Select Custom Attribute
Select Device
Select attribute

When I select the attribute I get a blank display with a Done button. If I click on Done then the button goes away but there is no other update to the window and I have to exit the application to do anything.

The error that I see in the logs is:

2021-12-21 12:42:16.352 pm [error]java.lang.NumberFormatException: null on line 1902 (method selectTriggers)

In addition to deleting the device I did reload from a automated backup from this morning. This did not help either.

I have tried this with Legacy Rule Machine 4.0 and Rule Machine 5.0

You need to tell us more about the custom attribute. What type is it? Show a screenshot of a device page where it is set (right side Current State display). Show us how it is defined in the driver, again, a screenshot of the code used.

I started with a driver from github that was linked in a post. The power attributes had been defined as string and I defined them as number in order to be able to use them in Rule Machine. I initially had the rule created but have modified the driver since then. Now when I try to use the attribute PowerTwo in rule machine, I get the error as noted.

If there is more information that you need or additional debugging I can do let me know.

If you changed the driver, that's why the rule crapped out. Remove the rule, and recreate it.

I did do that. I deleted the rule after the driver change and then went back to recreate it and that is the error that I currently get. I can select one of the other attributes such as energyOne that does not generate the error, but if I select either powerOne or powerTwo I get the error. Do I have a problem with the last statement where powerTwo is updated that I included above? I am not a groovy or hubitat expert so I am not sure that command is correct.

You need to show where the attribute is defined in the driver metadata.

Here are the attributes as they are defined. I modified powerOne and PowerTwo as noted.

Turn on Event and Trigger logging for the rule. See if anything is logged prior to the error.

Appreciate all of the help yesterday. A fresh set of eyes on the code this morning, I finally (duh) noticed the statement setting the value of the attribute was writing a string to the attribute defined as number. Once I modified the code to write a number to the attribute, I could successfully create the rule.

1 Like