While migrating an old OH2 rule to OH3, the following throws an Type-Mismatch error:
if (Astro_SunAzimuth.getState() > 235 && Astro_SunAzimuth.getState() < 245) {
...OR...
if (Astro_SunAzimuth.state > 235 && Astro_SunAzimuth.state < 245) {
in the logs:
2021-05-26 08:50:41.303 [ERROR] [internal.handler.ScriptActionHandler] - Script execution of rule with UID 'WebcamNachmittag' failed: if (Astro_SunAzimuth.getState() > 235 && Astro_SunElevation.getState() < 245) {
(...)
}
Type mismatch: cannot convert from int to String; line 4, column 190, length 1
I know your type is just Number, and the state contents appear to be just a number (no units)
but
Astro binding azimuth channel is a Number:Angle quantity type (it was in OH2 as well).
good to know. Presently I’m migrating the rules (as they throw errors all and about after migrating to OH3) and if I’m done with that, I’ll migrate from item-files to GUI-configuration, and then that’s very handy to know!
Yes, this will rear it’s head then. File configs allow you to force, uhh, mis-matches. GUI is more insistent about doing it right.
Such type changes will affect your rules.
This is a very useful tool and I recommend all users of OH to enable showing line numbers. Don’t count lines by hand.
Also useful is the ability to jump to a given line number. In VSCode type CTRL + G and type in the line number. To go to line number and column add a comma.
In MainUI, the line numbers are shown to you by default (I don’t think you can turn that off actually). But there isn’t a jump to line number feature that I’m aware of. But UI text blocks will tend to be really short anyway so that’s not too big of a deal.