[SOLVED] New [WARN] in log since fresh 3.0.1

Hi folks,

I’ve just migrated to 3.0.1, and I see this in my logs:

2021-03-15 09:43:54.334 [WARN ] [re.config.core.internal.ConfigMapper] - Could not set field value for field 'index': Can not set java.lang.String field org.openhab.binding.openuv.internal.config.SafeExposureConfiguration.index to java.math.BigDecimal
java.lang.IllegalArgumentException: Can not set java.lang.String field org.openhab.binding.openuv.internal.config.SafeExposureConfiguration.index to java.math.BigDecimal
	at jdk.internal.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:167) ~[?:?]
	at jdk.internal.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:171) ~[?:?]
	at jdk.internal.reflect.UnsafeObjectFieldAccessorImpl.set(UnsafeObjectFieldAccessorImpl.java:81) ~[?:?]
	at java.lang.reflect.Field.set(Field.java:780) ~[?:?]
	at org.openhab.core.config.core.internal.ConfigMapper.as(ConfigMapper.java:101) [bundleFile:?]
	at org.openhab.core.config.core.Configuration.as(Configuration.java:80) [bundleFile:?]
	at org.openhab.binding.openuv.internal.handler.OpenUVReportHandler.updateChannel(OpenUVReportHandler.java:234) [bundleFile:?]
	at org.openhab.binding.openuv.internal.handler.OpenUVReportHandler.lambda$2(OpenUVReportHandler.java:149) [bundleFile:?]
	at java.util.ArrayList.forEach(ArrayList.java:1541) [?:?]
	at java.util.Collections$UnmodifiableCollection.forEach(Collections.java:1085) [?:?]
	at org.openhab.binding.openuv.internal.handler.OpenUVReportHandler.updateChannels(OpenUVReportHandler.java:148) [bundleFile:?]
	at org.openhab.binding.openuv.internal.handler.OpenUVReportHandler.lambda$1(OpenUVReportHandler.java:134) [bundleFile:?]
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) [?:?]
	at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:305) [?:?]
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305) [?:?]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?]
	at java.lang.Thread.run(Thread.java:834) [?:?]

Any clue?

thanks
Andrea

You should recreate your Safeexposure channel, since this PR this channel configuration has changed from number to string.

Thank you @glhopital for your answer.

I’m doing the same mistake, but I’m not able to see it. Same error with the config below:

Bridge openuv:openuvapi:local "OpenUV API" @ "Accounts" [ apikey="<omitted>" ] {
    Thing uvreport home "Local UV" @ "Outdoor" [ location="<omitted>", refresh=20 ]{
        Channels:
            Type SafeExposure : pale [       
                index=1
            ]
            Type SafeExposure : white [
                index=2
            ]
            Type SafeExposure : light_brown [
                index=3
            ]
            Type SafeExposure : moderate_brown [
                index=4
            ]
            Type SafeExposure : dark_brown [
                index=5
            ]
            Type SafeExposure : black [
                index=6
            ]
    }
}

items:

Number Openuv_UVIndex                       "Current UV Index [%.2f]"                       (gOutdoor, gWeather, gChart, gHistory)          { channel = "openuv:uvreport:local:home:UVIndex" }
Number Openuv_UVIndexMax                    "Expected Max UV Index [%.2f]"                  (gOutdoor, gWeather)                            { channel = "openuv:uvreport:local:home:UVMax" }
DateTime Openuv_UVIndexMaxTime              "Max UV Index Time [%1$td/%1$tm - %1$tH:%1$tM]" (gOutdoor, gWeather)                            { channel = "openuv:uvreport:local:home:UVMaxTime" }
Switch Openuv_UVIndexMaxTime_Status
Number:ArealDensity Openuv_Ozone            "Ozone (du)[%.2f]"                              (gOutdoor, gWeather, gChart, gHistory)          { channel = "openuv:uvreport:local:home:Ozone" }
String Openuv_SafeExposure1                 "Safe Exposure I [%s]"                          (gOutdoor, gWeather)                            { channel = "openuv:uvreport:local:home:pale" }
String Openuv_SafeExposure2                 "Safe Exposure II [%s]"                         (gOutdoor, gWeather)                            { channel = "openuv:uvreport:local:home:white" }
String Openuv_SafeExposure3                 "Safe Exposure III [%s]"                        (gOutdoor, gWeather)                            { channel = "openuv:uvreport:local:home:light_brown" }
String Openuv_SafeExposure4                 "Safe Exposure IV [%s]"                         (gOutdoor, gWeather)                            { channel = "openuv:uvreport:local:home:moderate_brown" }
String Openuv_SafeExposure5                 "Safe Exposure V [%s]"                          (gOutdoor, gWeather)                            { channel = "openuv:uvreport:local:home:dark_brown" }
String Openuv_SafeExposure6                 "Safe Exposure VI [%s]"                         (gOutdoor, gWeather)                            { channel = "openuv:uvreport:local:home:black" }

index should be setup with one of the FitzPatrick values, so I,II,III,IV,V or VI.
Sorry this is missing in documentation. Maybe you could use your own example to extand binding doc here

        Channels:
            Type SafeExposure : pale [       
                index="I"
            ]
            Type SafeExposure : white [
                index="II"
            ]
            Type SafeExposure : light_brown [
                index="III"
            ]
            Type SafeExposure : moderate_brown [
                index="IV"
            ]
            Type SafeExposure : dark_brown [
                index="V"
            ]
            Type SafeExposure : black [
                index="VI"
            ]
    }
}

Same issue :frowning:

2021-03-15 11:17:31.935 [WARN ] [re.config.core.internal.ConfigMapper] - Could not set field value for field 'index': Can not set java.lang.String field org.openhab.binding.openuv.internal.config.SafeExposureConfiguration.index to java.math.BigDecimal
java.lang.IllegalArgumentException: Can not set java.lang.String field org.openhab.binding.openuv.internal.config.SafeExposureConfiguration.index to java.math.BigDecimal
	at jdk.internal.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:167) ~[?:?]
	at jdk.internal.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:171) ~[?:?]
	at jdk.internal.reflect.UnsafeObjectFieldAccessorImpl.set(UnsafeObjectFieldAccessorImpl.java:81) ~[?:?]
	at java.lang.reflect.Field.set(Field.java:780) ~[?:?]
	at org.openhab.core.config.core.internal.ConfigMapper.as(ConfigMapper.java:101) [bundleFile:?]
	at org.openhab.core.config.core.Configuration.as(Configuration.java:80) [bundleFile:?]
	at org.openhab.binding.openuv.internal.handler.OpenUVReportHandler.updateChannel(OpenUVReportHandler.java:234) [bundleFile:?]
	at org.openhab.binding.openuv.internal.handler.OpenUVReportHandler.lambda$2(OpenUVReportHandler.java:149) [bundleFile:?]
	at java.util.ArrayList.forEach(ArrayList.java:1541) [?:?]
	at java.util.Collections$UnmodifiableCollection.forEach(Collections.java:1085) [?:?]
	at org.openhab.binding.openuv.internal.handler.OpenUVReportHandler.updateChannels(OpenUVReportHandler.java:148) [bundleFile:?]
	at org.openhab.binding.openuv.internal.handler.OpenUVReportHandler.lambda$1(OpenUVReportHandler.java:134) [bundleFile:?]
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) [?:?]
	at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:305) [?:?]
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305) [?:?]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?]
	at java.lang.Thread.run(Thread.java:834) [?:?]

Can you try creating these fields using MainUI ?

well actually I use the things files, and I used to modify them manually

From what I see, it seems the channel in openuv.things is still using “number:time” scheme, instead of string:

mmm… when this change has been merged? I’m on 3.0.1

Just to try and ensure it works, so you’ll have the YAML version, it will help you check the thing file syntax

Sorry, just to be sure I understood correctly, idea is to remove the channels from the file and auto-discover?

Yes, remove the channels from your file and expand the thing with new channels (it’s not auto discoverable) : open the thing, and search “add channel”

where I can “add channel”?

On the other hand, I see also the “master” Safe Exposure as Number:Time, and not String :frowning:

Yes, the channel value is a Number:Time, but its configuration parameter is a String. But wait, maybe you’re not in the last binding version, expandable channels have been added recently.

I’m on openhabian, but I still need to understand how to move from stable 3.0.1 to last snapshot.

:slight_smile: working on it

Andrea

I’ve moved to 3.1, but not seeing any “expandable channel”

What I should see?

You should see something like that (note “Add channel” at the bottom of the screenshot) :

It gives you this YAML :

UID: openuv:uvreport:api:local
label: Local UV Report
thingTypeUID: openuv:uvreport
configuration:
  refresh: 10
  location: 58.996,9,822
bridgeUID: openuv:openuvapi:api
channels:
  - id: SafeExposure
    channelTypeUID: openuv:SafeExposure
    label: Safe Exposure
    description: Safe exposure time for Fitzpatrick Skin Types
    configuration:
      index: I
  - id: paleskin
    channelTypeUID: openuv:SafeExposure
    label: Pale Skin
    description: ""
    configuration:
      index: I

I’m on 3.1.0 build #2262 and I can’t see that :frowning:

Try creating a new UV Report in the MainUI. I suspect the metadata of your current report being stored with the old properties.

1 Like

Ta daa … :slight_smile: now I can see “Add channel”

question is if I can convert the MainUI configuration into a text to add to my things file manually

I think you can, maybe with a new ID so you ensure OH is using proper json description elements.

1 Like