NumberFormatException: For input string:

I was editing an app when I must have mismatched data types

I'd like to fix the error and proceed but the editor will not come up

Unfortunately I was just about finished coding a new block of code and would have been backing up. Since I can not loose what I have done a restore is out of question.

Any help is most appreciated.

What app is this? Native or custom? If it's custom and you're writing it, you should have a great deal of control over how to fix or work around the above, but it's hard to give specific advice without knowing more.

I have a new Zooz Power Switch. I'm playing around with it to gain some understanding.
I have this rule:

The rule that is causing the issue is almost the same except I was triggering on "energy changed". The problem came about when I was trying to log the energy and duration by first assigning to local variables.

Accessing the device was not an issue. Highlighted shows the attributes accessed.

So the app throwing this error (app 2328 in your logs) is a rule ("child app" within Rule Machine), I assume. Clicking the "error" (or other) label in the logs will take you to the offending app, or clicking "app 2328" on the left will filter the logs to just this app and highlight its name at the top. It will also match the number you see in the URL when viewing/editing the app. I assume it is not the entire/parent Rule Machine app.

Assuming that is correct: would you be OK with just re-creating this rule? It might be all you can do--once you get RM throwing these kinds of errors when you open the app (and it doesn't actually let you), there's usually no saving it besides starting over. It looks like you might have accidentally tried assigning a string value to a numeric variable, though I can't say for sure. You wouldn't have to restore an entire hub backup, though, if that's what you're thinking: just remove the old/current rule by going into the gear/cogs icon for this rule/app (use icon in the app list under "Apps" if you can't get to it any other way), where there should always be a "Remove" button. Then start again--if it's still as short as the other rule, hopefully this isn't too much work!

Clicking on the error in the logs does not open the rule but as you say I was able to delete the rule. Losing this rule is no big deal, it was the other rules I was concerned about.

I was having visions of the rule hanging around forever. I have learned several things from your response.

Thank you

I was assigning the energyDuration to a decimal. I assumed it to be a decimal value but I noticed the unit value (hours) is part of the response and hence a string.

Ah, yes, From what I can see, energyDuration is not a standard attribute, but in your case it looks like it includes the units as part of a string. Each device may vary here. The energy attribute is standard and required to be some numeric type (your luck may vary with community drivers, but it could be fixed if not; stock drivers should all work this way).

I am using the stock HE driver. Not having energyDuration as numeric makes it a PIA to use in variable math. I'm trying to get a tile to show the kW/hour value (as a prelude to more complicated rules). Am I missing something here, using the energy and energyDuration is the way to calculate kW/hour?

If you want this one fixed as a one off you can switch away from the OOB driver and create a driver that has two attributes; a String for display and a numeric value for comparisons and math. Otherwise, write an app to do the math where you can parse the unit out and then convert it to a numeric variable.