Homematic Binding - Value must be between 0 and 100 Exception

Hi,

I’m getting this exception from the homematic binding:

    2016-12-24 10:43:17.104 [ERROR] [ematic.handler.HomematicThingHandler] - Value must be between 0 and 100
java.lang.IllegalArgumentException: Value must be between 0 and 100
	at org.eclipse.smarthome.core.library.types.PercentType.validateValue(PercentType.java:51)[96:org.eclipse.smarthome.core:0.9.0.b2]
	at org.eclipse.smarthome.core.library.types.PercentType.<init>(PercentType.java:46)[96:org.eclipse.smarthome.core:0.9.0.b2]
	at org.eclipse.smarthome.core.library.types.DecimalType.as(DecimalType.java:151)[96:org.eclipse.smarthome.core:0.9.0.b2]
	at org.eclipse.smarthome.core.items.ItemUtil.convertToAcceptedState(ItemUtil.java:82)[96:org.eclipse.smarthome.core:0.9.0.b2]
	at org.eclipse.smarthome.core.thing.internal.ThingManager$1.stateUpdated(ThingManager.java:132)[103:org.eclipse.smarthome.core.thing:0.9.0.b2]
	at org.eclipse.smarthome.core.thing.binding.BaseThingHandler.updateState(BaseThingHandler.java:265)[103:org.eclipse.smarthome.core.thing:0.9.0.b2]
	at org.openhab.binding.homematic.handler.HomematicThingHandler.updateChannelState(HomematicThingHandler.java:248)[190:org.openhab.binding.homematic:2.0.0.b5]
	at org.openhab.binding.homematic.handler.HomematicThingHandler.updateDatapointState(HomematicThingHandler.java:224)[190:org.openhab.binding.homematic:2.0.0.b5]
	at org.openhab.binding.homematic.handler.HomematicBridgeHandler.onStateUpdated(HomematicBridgeHandler.java:233)[190:org.openhab.binding.homematic:2.0.0.b5]
	at org.openhab.binding.homematic.internal.communicator.AbstractHomematicGateway.eventReceived(AbstractHomematicGateway.java:581)[190:org.openhab.binding.homematic:2.0.0.b5]
	at org.openhab.binding.homematic.internal.communicator.server.BinRpcCallbackHandler.handleEvent(BinRpcCallbackHandler.java:129)[190:org.openhab.binding.homematic:2.0.0.b5]
	at org.openhab.binding.homematic.internal.communicator.server.BinRpcCallbackHandler.handleMethodCall(BinRpcCallbackHandler.java:84)[190:org.openhab.binding.homematic:2.0.0.b5]
	at org.openhab.binding.homematic.internal.communicator.server.BinRpcCallbackHandler.handleMethodCall(BinRpcCallbackHandler.java:98)[190:org.openhab.binding.homematic:2.0.0.b5]
	at org.openhab.binding.homematic.internal.communicator.server.BinRpcCallbackHandler.run(BinRpcCallbackHandler.java:62)[190:org.openhab.binding.homematic:2.0.0.b5]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)[:1.8.0_101]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)[:1.8.0_101]
	at java.lang.Thread.run(Thread.java:745)[:1.8.0_101]

This is currently flooding my logs… Any ideas? I could guess one item is coming wrong from homegear - but could we catch the exception?

thanks - regards Markus

Hi Markus,

you could set the log level for Homematic to “trace” with the following command in the Kara console: log:set TRACE org.openhab.binding.homematic. This should give more infomation and may help identify the device.

BTW: Which openHAB version are you using?

Hi Martin,

I checked but did not find anything suspicious…
Version is OH2 - Beta 4 (and since today moring Beta 5, which did also not change anything)

Hmm I have looked into the coding that is used to set percent values and to me it looks fine. As far as I can see there may be a problem if a datapoint has a negative value.

So It would be the best to create an issue with the attached log and then @gerrieg can checkt it.

Just stop the binding, switch it to TRACE mode and start it. Wait until all devices have been found and until the first exception occurs. Send me the full logfile, then i can say what’s wrong

stop org.openhab.binding.homematic
log:set TRACE org.openhab.binding.homematic
start org.openhab.binding.homematic

Hi Markus,
I recently had the same behavior, when I used a Dimmer type instead of a number type in the item definition. So I would also check for all Dimmer types, if the value is always between 0 nd 100.

Chris

@mm1804
Thank you for the TRACE log. The metadata looks good, so i also think you are using a wrong item type (Dimmer instead of Number)

I’ve implemented a warning message in the log for such cases. Please use this version to identify the datapoint: Download

openhab.xml (993.8 KB)

Hi Guys,
i have updated to OH 2.1 from OH 2.0. Both using the GA Version, no Snapshots.
Usually i am using the HABPanel on an iPad in Landscape mode, but for just testing results of items i use the BasicUI sometimes as well.
This morning was such Situation and i ran into a Problem that the Sitemap was crashing with this Error:

##################################
HTTP ERROR 500

Problem accessing /basicui/app. Reason:

Server Error

Caused by:

java.lang.IllegalArgumentException: Value must be between 0 and 100
at org.eclipse.smarthome.core.library.types.PercentType.validateValue(PercentType.java:50)
at org.eclipse.smarthome.core.library.types.PercentType.(PercentType.java:45)
at org.eclipse.smarthome.core.library.types.DecimalType.as(DecimalType.java:153)
at org.eclipse.smarthome.core.items.GenericItem.getStateAs(GenericItem.java:87)
at org.eclipse.smarthome.ui.internal.items.ItemUIRegistryImpl.convertState(ItemUIRegistryImpl.java:485)
at org.eclipse.smarthome.ui.internal.items.ItemUIRegistryImpl.getState(ItemUIRegistryImpl.java:464)
at org.eclipse.smarthome.ui.basic.internal.render.AbstractWidgetRenderer.getState(AbstractWidgetRenderer.java:229)
at org.eclipse.smarthome.ui.basic.internal.render.AbstractWidgetRenderer.preprocessSnippet(AbstractWidgetRenderer.java:92)
at org.eclipse.smarthome.ui.basic.internal.render.SliderRenderer.renderWidget(SliderRenderer.java:46)
at org.eclipse.smarthome.ui.basic.internal.render.PageRenderer.renderWidget(PageRenderer.java:164)
at org.eclipse.smarthome.ui.basic.internal.render.PageRenderer.processChildren(PageRenderer.java:129)
at org.eclipse.smarthome.ui.basic.internal.render.PageRenderer.processChildren(PageRenderer.java:150)
at org.eclipse.smarthome.ui.basic.internal.render.PageRenderer.processPage(PageRenderer.java:92)
at org.eclipse.smarthome.ui.basic.internal.servlet.WebAppServlet.service(WebAppServlet.java:152)
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:812)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:587)
at org.ops4j.pax.web.service.jetty.internal.HttpServiceServletHandler.doHandle(HttpServiceServletHandler.java:71)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:577)
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:223)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1127)
at org.ops4j.pax.web.service.jetty.internal.HttpServiceContext.doHandle(HttpServiceContext.java:287)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1061)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
at org.ops4j.pax.web.service.jetty.internal.JettyServerHandlerCollection.handle(JettyServerHandlerCollection.java:80)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
at org.eclipse.jetty.server.Server.handle(Server.java:499)
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:311)
at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:257)
at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:544)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)
at java.lang.Thread.run(Thread.java:745)
Powered by Jetty://
##################################

I tracked it down to one single line in my sitemap:

Frame label=“Bad” {
Group label=“Heizung” item=gTemperaturIst {
Group item=gTemperaturSoll }
Slider item=Bad_Heizungsthermostat_SOLL_Temperatur
Setpoint item=Bad_Heizungsthermostat_SOLL_Temperatur
Text label=“Ist Temperatur” item=Bad_Heizungsthermostat_IST_Temperatur
Text icon=“window” label=“Fensterstellung” item=Bad_Fenster_Status
}

As soon i add the Slider /Slider item=Bad_Heizungsthermostat_SOLL_Temperatur) to my sitemap, which is a Homematic Thermostate, i get the Error 500.

This is my item Definition:
Number Bad_Heizungsthermostat_SOLL_Temperatur “Heizungsthermostat Bad SOLL Temperatur” (gBad, gHeizung, gTemperaturSoll, gChart_Bad) {channel=“homematic:HM-TC-IT-WM-W-EU:6d1a3e28:MEQ0745413:2#SET_TEMPERATURE”}

My Log with TRACE Mode on is attached. No idea if this is a Bug or i have done something wrong in my sitemap or item definition.

BR
Andreas

I think the error 500 is not caused by this exception. Normally you get an error 500 only in case of errors that prevent a sitemap from rendering.

According to the log there is a problem with the sitemap:

2017-07-14 06:29:46.844 [INFO ] [el.core.internal.ModelRepositoryImpl] - Refreshing model 'home.sitemap'
2017-07-14 06:29:46.980 [WARN ] [el.core.internal.ModelRepositoryImpl] - Configuration model 'home.sitemap' has errors, therefore ignoring it: [14,1]: mismatched input '#' expecting '}'
[20,1]: missing EOF at 'Frame'

2017-07-14 06:44:54.516 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'home.sitemap'
2017-07-14 06:44:54.669 [INFO ] [el.core.internal.ModelRepositoryImpl] - Refreshing model 'home.sitemap'
2017-07-14 06:45:52.059 [INFO ] [el.core.internal.ModelRepositoryImpl] - Refreshing model 'home.sitemap'
2017-07-14 06:45:52.067 [WARN ] [el.core.internal.ModelRepositoryImpl] - Configuration model 'home.sitemap' is either empty or cannot be parsed correctly!

You should check line 14 in your sitemap. If your posted excerpt of the sitemap is correct then I would says that the “}” after Group item=gTemperaturSollis wrong and maybe causes the problem.

If my assumption is wrong please stop openHAB, delete the log file, restart openHAB, load the sitemap with error 500 and then post also relevant item definition and sitemap.