Tado Binding doesn't accept command via REST

Hi,

i’m trying to setup the tado binding, but i’m experiencing some difficulties.
I only want to change the target temperature for now.
This is what the item and the sitemap looks like:

Number:Temperature TestTemperatur "Set Point" {channel="tado:zone:demo:heating:targetTemperature" }
Setpoint item=TestTemperatur label="Soll-Temperatur" step=1.0 minValue=5 maxValue=25

Using the web ui i can now change the temperature, but somehow the REST interface is not working. When i change the item state to a new value via the REST interface, the new value is shown for a few seconds in the web ui before changing back to the old value.

This is what the log says:

2018-09-13 16:25:44.852 [vent.ItemStateChangedEvent] - TestTemperatur changed from 19.0 ℃ to 20.0 ℃
2018-09-13 16:25:58.425 [vent.ItemStateChangedEvent] - TestTemperatur changed from 20.0 ℃ to 19.0 ℃

I don’t know why it does that. Any ideas?

Are you sending a command (POST) or posting an update (PUT)?

It sounds like you are doing an update which only changes the state of the Item in OH. It does not go on to the device. Later the device reports or the binding polls the device for its current setting and the Item gets set back to that value.

When you send a command, the new value will actually get sent to the device.

I’ve tried both PUT and POST but they are both not working.
Also the openHAB app for Android produces the same result.

Errors in the log?

When you say the REST interface is not working, are you referring to the openHAB REST API or some other API?

Does it actually work or not when using the OH web UI? Which OH web UI? Or does it change then change back?

The logs i posted above is everything i get, so no errors.

I’m talking about the openHAB REST API.
It’s working fine when i use the web ui (Basic UI), i can see in the tado app that the value changed. Only the openHAB REST API is not working, when i send a command i can see the value changing in the Basic UI, but it changes back to the old value after a few seconds.

What is odd is that BasicUI uses the REST API to send the command. So the REST API has to work or else BasicUI wouldn’t.

You are using a POST to http://address:8080/rest/items/<itemname>? The behavior you are describing matches what you happen if you are using a PUT to http://address:8080/rest/items/<itemname>/state.

Note the different HTTP command and the different URLs.

Weird, but i’m really using POST here. And since the app produces the same result i don’t think i made a mistake, at least not on the client side.

When you issue the POST command to the correct URL (i.e. no “/state” part), do you see in events.log "Item ‘TestTemperatur’ received command "?

If you don’t see that then your Item is not receiving the command. It is only receiving an update. Unfortunately, by default, events.log doesn’t show updates, only changes and commands. But if you see the changed log statement without the received command log statement you can infer that there was an update.

So, watching events.log, do you see the received command statement when you change the Item from Basic UI? Do you see it with the POST? Do you see it with the phone app?

What is the exact URL you are using with the POST?

This is what i get for both POST and the Basic UI:

2018-09-14 20:26:58.535 [ome.event.ItemCommandEvent] - Item 'TestTemperatur' received command 9
2018-09-14 20:26:58.559 [vent.ItemStateChangedEvent] - TestTemperatur changed from 7.0 ℃ to 9.0 ℃

Using POST i also got this error which i somehow didn’t get yesterday:

2018-09-14 20:26:58.542 [ERROR] [nal.common.AbstractInvocationHandler] - An error occurred while calling method 'ThingHandler.handleCommand()' on 'org.openhab.binding.tado.handler.TadoZoneHandler@13a9a72': org.eclipse.smarthome.core.library.types.DecimalType cannot be cast to org.eclipse.smarthome.core.library.types.QuantityType
java.lang.ClassCastException: org.eclipse.smarthome.core.library.types.DecimalType cannot be cast to org.eclipse.smarthome.core.library.types.QuantityType
        at org.openhab.binding.tado.handler.TadoZoneHandler.handleCommand(TadoZoneHandler.java:121) [210:org.openhab.binding.tado:2.3.0]
        at sun.reflect.GeneratedMethodAccessor140.invoke(Unknown Source) ~[?:?]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
        at java.lang.reflect.Method.invoke(Method.java:497) ~[?:?]
        at org.eclipse.smarthome.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:153) [101:org.eclipse.smarthome.core:0.10.0.oh230]
        at org.eclipse.smarthome.core.internal.common.InvocationHandlerSync.invoke(InvocationHandlerSync.java:59) [101:org.eclipse.smarthome.core:0.10.0.oh230]
        at com.sun.proxy.$Proxy122.handleCommand(Unknown Source) [210:org.openhab.binding.tado:2.3.0]
        at org.eclipse.smarthome.core.thing.internal.profiles.ProfileCallbackImpl.handleCommand(ProfileCallbackImpl.java:75) [108:org.eclipse.smarthome.core.thing:0.10.0.oh230]
        at org.eclipse.smarthome.core.thing.internal.profiles.SystemDefaultProfile.onCommandFromItem(SystemDefaultProfile.java:49) [108:org.eclipse.smarthome.core.thing:0.10.0.oh230]
        at sun.reflect.GeneratedMethodAccessor139.invoke(Unknown Source) ~[?:?]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
        at java.lang.reflect.Method.invoke(Method.java:497) ~[?:?]
        at org.eclipse.smarthome.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:153) [101:org.eclipse.smarthome.core:0.10.0.oh230]
        at org.eclipse.smarthome.core.internal.common.Invocation.call(Invocation.java:53) [101:org.eclipse.smarthome.core:0.10.0.oh230]
        at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:?]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [?:?]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [?:?]
        at java.lang.Thread.run(Thread.java:745) [?:?]

I get the same error message using the app. This is the URL: http://192.168.0.27:8080/rest/items/TestTemperatur

OK, we have verified that the value is being received and that it is being received as a command. But the binding is running into trouble. It is expecting a QuantityType, not a DecimalType.

QuantityType is used for units like temperature so people can specify degrees C or degrees F without needing code to convert between them.

Sadly I have no experience with these yet. @vzorglub, what are we doing wrong here? Or is this something wrong with the binding? Any thoughts?

I think this should be

Number TestTemperatur "Set Point" [...]

I’ve tried this and now even the Basic UI produces the same error as above.

Then I suppose it’s just a problem with REST and not with the binding at all.

I’ve got the same exception when I try to set a target temp via
Tado_target_temp.sendCommand("10.0")
But also no clue whats wrong here…

Hi all, I’m new to OpenHAB so please be nice! :slight_smile:

I am also having the same issue with a new install of OpenHABian and Tado Binding:

2018-12-04 23:12:23.717 [ERROR] [nal.common.AbstractInvocationHandler] - An error occurred while calling method ‘ThingHandler.handleCommand()’ on ‘org.openhab.binding.tado.handler.TadoZoneHandler@18aa4f9’: org.eclipse.smarthome.core.library.types.DecimalType cannot be cast to org.eclipse.smarthome.core.library.types.QuantityType

All other parts seem to work, so for example I can change the heating mode from timer to manual, etc. and it then sends through to Tado. The only thing which does not work is changing the requested temperature.

The thing which is strange is that if you do this in the Paper UI, it DOES work successfully. Just not in the HABPanel version.

Does anyone have any thoughts why this could be?

Thanks!

All,

Started to enjoy Openhab 2 weeks ago, everything works fine but I am running into the same issue :
this error only occurs in habpanel, not in basic UI and not Classic UI.

Did you find a solution or work-around ?

Much appreciated.

Running openhabianpi-raspbian

2018-12-14 06:49:54.660 [ERROR] [nal.common.AbstractInvocationHandler] - An error occurred while calling method ‘ThingHandler.handleCommand()’ on ‘org.openhab.binding.tado.handler.TadoZoneHandler@467afd’: org.eclipse.smarthome.core.library.types.DecimalType cannot be cast to org.eclipse.smarthome.core.library.types.QuantityType

Since no one seems to be working on this i fixed it myself. This is just a dirty fix and only works with celsius.
To use it uninstall the binding first, download the fixed binding here and place it in the addons folder.

1 Like

Thnx!! Your fix worked. waited so long for this fix ;p