At the moment I’m using the old MQTT binding to controll some Sonoff Tasmota devices. After upgrading to openHAB 2.4 I wanted to switch to the new MQTT 2 binding, but I didn’t get it working. I can’t controll the device and I don’t see any messages on the broker. This is my mqtt.things:
Bridge mqtt:broker:MqttBroker [ host="photon-machine", secure=false, port=1883 ]
{
Thing topic sofa {
Channels:
Type switch : switch "Power Switch" [ stateTopic="stat/sofa/POWER", commandTopic="cmnd/sofa/POWER" ]
}
}
and the mqtt.items:
Switch SofaNew_On "Sofa On MQTT2" (Wohnzimmer) { channel="mqtt:topic:MqttBroker:sofa:switch" }
Whenever I change something in the things file I get the following message in the logs:
2019-01-18 21:15:51.699 [ERROR] [nal.common.AbstractInvocationHandler] - An error occurred while calling method 'Runnable.run()' on 'org.eclipse.smarthome.core.thing.internal.ThingManagerImpl$$Lambda$692/1461730391@128923': org.eclipse.smarthome.binding.mqtt.generic.internal.handler.GenericThingHandler cannot be cast to org.eclipse.smarthome.binding.mqtt.handler.AbstractBrokerHandler
java.lang.ClassCastException: org.eclipse.smarthome.binding.mqtt.generic.internal.handler.GenericThingHandler cannot be cast to org.eclipse.smarthome.binding.mqtt.handler.AbstractBrokerHandler
at org.eclipse.smarthome.binding.mqtt.internal.MqttBrokerHandlerFactory.lambda$0(MqttBrokerHandlerFactory.java:83) ~[?:?]
at java.util.WeakHashMap.forEach(WeakHashMap.java:1025) ~[?:?]
at java.util.Collections$SynchronizedMap.forEach(Collections.java:2647) ~[?:?]
at org.eclipse.smarthome.binding.mqtt.internal.MqttBrokerHandlerFactory.removeHandler(MqttBrokerHandlerFactory.java:83) ~[?:?]
at org.eclipse.smarthome.core.thing.binding.BaseThingHandlerFactory.unregisterHandler(BaseThingHandlerFactory.java:261) ~[?:?]
at org.eclipse.smarthome.core.thing.internal.ThingManagerImpl.lambda$5(ThingManagerImpl.java:811) ~[?:?]
at sun.reflect.GeneratedMethodAccessor95.invoke(Unknown Source) ~[?:?]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:?]
at org.eclipse.smarthome.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:153) [102:org.eclipse.smarthome.core:0.10.0.oh240]
at org.eclipse.smarthome.core.internal.common.Invocation.call(Invocation.java:53) [102:org.eclipse.smarthome.core:0.10.0.oh240]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:?]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:?]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:?]
at java.lang.Thread.run(Thread.java:748) [?:?]
2019-01-18 21:15:51.735 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'mqtt.things'
2019-01-18 21:15:51.743 [INFO ] [.transport.mqtt.MqttBrokerConnection] - Starting MQTT broker connection to 'photon-machine' with clientid paho2941222602831 and file store '/openhab/userdata/mqtt/photon-machine'
2019-01-18 21:15:52.767 [INFO ] [el.core.internal.ModelRepositoryImpl] - Refreshing model 'mqtt.things'
2019-01-18 21:15:52.832 [INFO ] [.transport.mqtt.MqttBrokerConnection] - Starting MQTT broker connection to 'photon-machine' with clientid paho2942309173314 and file store '/openhab/userdata/mqtt/photon-machine'
Can this be the reason why it does not work and does anyone know how to solve the problem?