[SOLVED] Problems with powerview - Could not set field value for field 'id': Can not set int field


(Mark) #1

I had to delete a powerview shade from my hub and reinstall it. Everything works succesfully on the hub side and with the powerview app. However after this operation openhab is no longer able to set values to the powerview shades. I removed all powerview shades and the hub from openhab, readded them, no success, also tried removing the powerview binding and reinstalling that.

The error I am getting is

2017-07-12 12:30:05.479 [WARN ] [.smarthome.config.core.Configuration] - Could not set field value for field ‘id’: Can not set int field org.openhab.binding.hdpowerview.config.HDPowerViewShadeConfiguration.id to java.lang.String
java.lang.IllegalArgumentException: Can not set int field org.openhab.binding.hdpowerview.config.HDPowerViewShadeConfiguration.id to java.lang.String
at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:167)[:1.8.0_121]
at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:171)[:1.8.0_121]
at sun.reflect.UnsafeIntegerFieldAccessorImpl.set(UnsafeIntegerFieldAccessorImpl.java:98)[:1.8.0_121]
at java.lang.reflect.Field.set(Field.java:764)[:1.8.0_121]
at org.apache.commons.lang.reflect.FieldUtils.writeField(FieldUtils.java:523)[31:org.apache.commons.lang:2.6.0]
at org.apache.commons.lang.reflect.FieldUtils.writeField(FieldUtils.java:500)[31:org.apache.commons.lang:2.6.0]
at org.apache.commons.lang.reflect.FieldUtils.writeField(FieldUtils.java:560)[31:org.apache.commons.lang:2.6.0]
at org.eclipse.smarthome.config.core.Configuration.as(Configuration.java:96)[95:org.eclipse.smarthome.config.core:0.9.0.b5]
at org.openhab.binding.hdpowerview.handler.HDPowerViewHubHandler.getThingsByShadeId(HDPowerViewHubHandler.java:213)[231:org.openhab.binding.hdpowerview:2.1.0]
at org.openhab.binding.hdpowerview.handler.HDPowerViewHubHandler.pollShades(HDPowerViewHubHandler.java:154)[231:org.openhab.binding.hdpowerview:2.1.0]
at org.openhab.binding.hdpowerview.handler.HDPowerViewHubHandler.poll(HDPowerViewHubHandler.java:139)[231:org.openhab.binding.hdpowerview:2.1.0]
at org.openhab.binding.hdpowerview.handler.HDPowerViewHubHandler.access$0(HDPowerViewHubHandler.java:136)[231:org.openhab.binding.hdpowerview:2.1.0]
at org.openhab.binding.hdpowerview.handler.HDPowerViewHubHandler$1.run(HDPowerViewHubHandler.java:235)[231:org.openhab.binding.hdpowerview:2.1.0]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)[:1.8.0_121]
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)[:1.8.0_121]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)[:1.8.0_121]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)[:1.8.0_121]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)[:1.8.0_121]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)[:1.8.0_121]
at java.lang.Thread.run(Thread.java:745)[:1.8.0_121]

This error gets repeated over and over.


(Kevin Marlow) #2

I have just got 4 blinds and would like to set them up with OpenHab but have the same stack trace as you.
I also have an issue with one of the blinds not responding to the scene all the time - are all of yours OK?


(Mark) #3

I sometimes have that problem as well, but I think the same is true if I use the app.


(Kevin Marlow) #4

Turning on debug on core, I think that we have a buggy version of the hdpowerview binding which is trying to set a String to int field wanted in the configuration.
This is odd, since if I look in HABMin the ID is shown as set and if I run the REST API http://localhost:8080/rest/things/hdpowerview%3Ashade%3A5257 then I also see the ID value.

15:34:27.427 [DEBUG] [.smarthome.config.core.Configuration] - Setting value (int) 5257 to field ‘id’ in configuration class org.openhab.binding.hdpowerview.config.HDPowerViewShadeConfiguration
15:34:27.429 [WARN ] [.smarthome.config.core.Configuration] - Could not set field value for field ‘id’: Can not set int field org.openhab.binding.hdpowerview.config.HDPowerViewShadeConfiguration.id to java.lang.String
java.lang.IllegalArgumentException: Can not set int field org.openhab.binding.hdpowerview.config.HDPowerViewShadeConfiguration.id to java.lang.String
at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:167)[:1.8.0_65]
at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:171)[:1.8.0_65]
at sun.reflect.UnsafeIntegerFieldAccessorImpl.set(UnsafeIntegerFieldAccessorImpl.java:98)[:1.8.0_65]
at java.lang.reflect.Field.set(Field.java:764)[:1.8.0_65]
at org.apache.commons.lang.reflect.FieldUtils.writeField(FieldUtils.java:523)[30:org.apache.commons.lang:2.6.0]
at org.apache.commons.lang.reflect.FieldUtils.writeField(FieldUtils.java:500)[30:org.apache.commons.lang:2.6.0]
at org.apache.commons.lang.reflect.FieldUtils.writeField(FieldUtils.java:560)[30:org.apache.commons.lang:2.6.0]
at org.eclipse.smarthome.config.core.Configuration.as(Configuration.java:96)[94:org.eclipse.smarthome.config.core:0.9.0.b5]
at org.openhab.binding.hdpowerview.handler.HDPowerViewHubHandler.getThingsByShadeId(HDPowerViewHubHandler.java:213)[234:org.openhab.binding.hdpowerview:2.1.0]
at org.openhab.binding.hdpowerview.handler.HDPowerViewHubHandler.pollShades(HDPowerViewHubHandler.java:154)[234:org.openhab.binding.hdpowerview:2.1.0]
at org.openhab.binding.hdpowerview.handler.HDPowerViewHubHandler.poll(HDPowerViewHubHandler.java:139)[234:org.openhab.binding.hdpowerview:2.1.0]
at org.openhab.binding.hdpowerview.handler.HDPowerViewHubHandler.access$0(HDPowerViewHubHandler.java:136)[234:org.openhab.binding.hdpowerview:2.1.0]
at org.openhab.binding.hdpowerview.handler.HDPowerViewHubHandler$1.run(HDPowerViewHubHandler.java:235)[234:org.openhab.binding.hdpowerview:2.1.0]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)[:1.8.0_65]
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)[:1.8.0_65]


(Kevin Marlow) #5

I also see the message “[view.handler.HDPowerViewShadeHandler] - PowerView shades do not support StopMove commands” when pressing the Stop button in PaperUI.
Might it be possible to read the position of the blind and then set it as the current position? This would have the effect of stopping the blind ?


(Mark) #6

It might. On the powerview remote there is a stop button


(Andy Lintner) #7

Sorry guys, I tend not to update the runtime very often on my production server, so I missed this. I have a fix incoming. Follow along here: https://github.com/openhab/openhab2-addons/issues/2520


(Mark) #8

Great news. Thanks


(Kevin Marlow) #9

That’s great. I tried to change my local build from int to String, but it failed because the Thing stores an id with the number as a string like this “1234.0” and the shades have the id as “1234”.
My horrible fix is:

private void pollShades() throws IOException {
    Shades shades = webTargets.getShades();
    updateStatus(ThingStatus.ONLINE);
    if (shades != null) {
        Map<String, Thing> things = getThingsByShadeId();
        logger.debug("Found {} shades", things.size());
        for (Shade shade : shades.shadeData) {
            Thing thing = things.get(shade.id + ".0");

(Andy Lintner) #10

Here’s the updated JAR: https://openhab.jfrog.io/openhab/libs-pullrequest-local/org/openhab/binding/org.openhab.binding.hdpowerview/2.2.0-SNAPSHOT/org.openhab.binding.hdpowerview-2.2.0-SNAPSHOT.jar


(Mark) #11

Thanks. Will try this probably tomorrow. Will it work on 2.1?


(Andy Lintner) #12

It seems to


(Mark) #13

It doesn’t seem to work for me. I still get the same error.


(Andy Lintner) #14

Hmmm… are you sure you’re using the new bundle? What’s the output of bundle:list?


(Mark) #15

240 | Active | 80 | 2.2.0.201708071544 | Hunter Douglas PowerView Binding


(Mark) #16

Downloaded the file again. Installed again, same error. Output of bundle:list is now:
242 | Active | 80 | 2.2.0.201708090812 | Hunter Douglas PowerView Binding


(Kevin Marlow) #17

Where do we actually put the bundle for it to be picked up?
Do we need to uninstall the binding first in PaperUI?
How do we get our install to refresh the channels for the scenes, in case we create some new ones or delete them?
Sorry for all the questions !


(Mark) #18

I first uninstalled the powerview binding. After that I installed the new binding by copying it into the addon directory. On my pi I can access that by /svr/openhab2-addons. That is a link openhabian can add for you.


(Kevin Marlow) #19

Thanks. And do you find that the channel names correspond to the scenes that you have set up?
Mine are showing some old scene names, that I had deleted or renamed.


(Mark) #20

Sorry, I don’t understand that question. What do you mean by a scene? Do you mean an item?