After a long battle with exec.whitelist(!) finally got my command scripts to run which exposed another problem.
I have a Rule which converts a string to a number. Not sure where I got the rule (somewhere on this site?) but it has worked without errors until I got to 2.5.3
The rule is:
<
rule “onewiretempValue1 String to Number”
when
Item onewiretemp1Value changed
then onewiretemp1Value_num.postUpdate(Float::parseFloat(String::format(“%s”,onewiretemp1Value.state).replace(’ ‘,’')))
end
The error I get is:
<Rule ‘onewiretempValue1 String to Number’: The name ‘onewiretemp1Value_num’ cannot be resolved to an item or type; line 132, column 5, length 21>
onewiretemp1Value_num is defined in my Items file as a Number, as it always has been.
when working normally my event log shows:
<20:38:56.243 [INFO ] [smarthome.event.ItemStateChangedEvent] - onewiretemp1Value changed from 27.500 to 27.000
20:38:56.269 [INFO ] [smarthome.event.ItemStateChangedEvent] - onewiretemp1Value_num changed from 27.5 to 27.0
There are a variety of ways to get code fences, but I usually just select the text and press the </> button. Unfortunately, it sometimes gets a little messy with long, unbroken strings of text.
Number onewiretemp1Value_num "HVAC Main [%.1f °C]" (gTemp)
rule “onewiretempValue1 String to Number” when Item onewiretemp1Value changed thenonewiretemp1Value_num.postUpdate(Float::parseFloat(String::format("%s",onewiretemp1Value.state).replace(’ ‘,’’))) end
Since it works when you revert to 2.5.0, I would guess that the item didn’t load properly after the upgrade.
Why did you go to 2.5.3 instead of straight to 2.5.10?
Yeah, I just clone my SD card whenever I’m going to upgrade, so that I can immediately fall back.
Unfortunately, I can’t help you with the converstion string, but I’m not convinced it’s the problem since your error is saying that the item couldn’t be resolved.
I guess that post is similar but my rule predates it by at least a couple years.
You’re right, the system is complaining about resolving the item type which should be valid.
BTW, I’ve got 4 of these temp sensors and they were all generating errors so it’s unlikely to be a file load issue, but I’ll try upgrading again when I have time to burn.
I was using the SD card clone method until I got a new laptop which does not like Win32DiskImager!
another issue to track down…
Is this the only Item you see an error like that for or are other Items that should exist being reported as missing too? A good way to check is opening the sitemap. Your log will be flooded with errors about missing Items.
If this is the case, wait for OH to complete coming up and then restart it without clearing the cache. This is a known bug in OH 2.
If that isn’t the case, there is something wrong with the Item definition or .items file that is causing it not to be created.
Three other variations of that item. onewiretemp1Value_num, onewiretemp2Value_num, etc
Those are the only ones giving errors which led me to thinking it was something about the expression they were being used in.