dvdgeisler / DirigeraClient

Dirigera Client API: Java written client API to interface IKEA's new smarthome hub DIRIGERA
MIT License
74 stars 9 forks source link

dirigera-client-mqtt JSON Error in HassLightDeviceEventHandler #103

Closed maxeitelwein closed 5 months ago

maxeitelwein commented 5 months ago

The MQTT application crashes when it is trying to subscribe to the HassLightDeviceEventHandler. Its constructor cannot seem to find the JSON type id deviceSet as a Subtype of de.dvdgeisler.iot.dirigera.client.api.model.scene.SceneAction. The complete Stacktrace is as followed:

2024-02-04 10:08:34.607 DEBUG 75925 --- [           main] .d.i.d.c.m.DirigeraClientMqttApplication : Running with Spring Boot v2.7.5, Spring v5.3.23
2024-02-04 10:08:34.609  INFO 75925 --- [           main] .d.i.d.c.m.DirigeraClientMqttApplication : No active profile set, falling back to 1 default profile: "default"
2024-02-04 10:08:35.716  INFO 75925 --- [           main] d.d.i.d.client.api.http.TokenStore       : Load access token
2024-02-04 10:08:36.380  INFO 75925 --- [           main] d.d.i.d.client.api.http.ClientOAuthApi   : Dirigera client name: mendoza
2024-02-04 10:08:36.432  INFO 75925 --- [oundedElastic-1] d.d.i.dirigera.client.api.WebSocketApi   : Start event handler thread: id=21, name=boundedElastic-1
2024-02-04 10:08:37.364  INFO 75925 --- [oundedElastic-2] d.d.i.d.client.api.http.ClientApi        : Start ping thread: id=31, name=boundedElastic-2
2024-02-04 10:08:37.577  INFO 75925 --- [           main] .d.i.d.c.m.DirigeraClientMqttApplication : Connect to MQTT broker: host=localhost, port=1883, publisherId=myID, reconnect=true, timeout=0, useSsl=false
2024-02-04 10:08:37.900  INFO 75925 --- [           main] .d.i.d.c.m.DirigeraClientMqttApplication : Connection to MQTT broker successfully established
2024-02-04 10:08:37.913  INFO 75925 --- [           main] d.d.i.d.client.mqtt.MqttEventHandler     : Subscribe HassBlindsDeviceEventHandler to Dirigera websocket: event=DeviceEvent
2024-02-04 10:08:38.311  INFO 75925 --- [           main] d.d.i.d.client.mqtt.MqttEventHandler     : Subscribe HassAirPurifierEventHandler to Dirigera websocket: event=DeviceEvent
2024-02-04 10:08:38.351  INFO 75925 --- [           main] d.d.i.d.client.mqtt.MqttEventHandler     : Subscribe HassOutletDeviceEventHandler to Dirigera websocket: event=DeviceEvent
2024-02-04 10:08:38.388  INFO 75925 --- [           main] d.d.i.d.client.mqtt.MqttEventHandler     : Subscribe HassLightDeviceEventHandler to Dirigera websocket: event=DeviceEvent
2024-02-04 10:08:38.582 ERROR 75925 --- [           main] o.s.boot.SpringApplication               : Application run failed

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hassLightDeviceEventHandler'
 defined in URL [jar:file:/home/maximilian/Hassio-Dirigera-Client/dirigera-client-mqtt.jar!/BOOT-INF/classes!/de/dvdgeisler
/iot/dirigera/client/mqtt/hass/HassLightDeviceEventHandler.class]: Bean instantiation via constructor failed; nested exception is
 org.springframework.beans.BeanInstantiationException: Failed to instantiate 
[de.dvdgeisler.iot.dirigera.client.mqtt.hass.HassLightDeviceEventHandler]: Constructor threw exception; nested exception is 
org.springframework.core.codec.DecodingException: JSON decoding error: Could not resolve type id 'deviceSet' as a subtype of 
`de.dvdgeisler.iot.dirigera.client.api.model.scene.SceneAction`: known type ids = [SceneAction, device] (for POJO property 
'actions'); nested exception is com.fasterxml.jackson.databind.exc.InvalidTypeIdException: Could not resolve type id 'deviceSet' 
as a subtype of `de.dvdgeisler.iot.dirigera.client.api.model.scene.SceneAction`: known type ids = [SceneAction, device] (for POJO property 'actions')
 at [Source: (io.netty.buffer.ByteBufInputStream); line: 1, column: 14614] (through reference chain: de.dvdgeisler.iot.dirigera.client.api.model.Home["scenes"]->java.util.ArrayList[0]->de.dvdgeisler.iot.dirigera.client.api.model.scene.SceneAttributes["actions"]->java.util.ArrayList[1])
    at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:315) ~[spring-beans-5.3.23.jar!/:5.3.23]
    at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:296) ~[spring-beans-5.3.23.jar!/:5.3.23]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1372) ~[spring-beans-5.3.23.jar!/:5.3.23]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1222) ~[spring-beans-5.3.23.jar!/:5.3.23]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:582) ~[spring-beans-5.3.23.jar!/:5.3.23]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542) ~[spring-beans-5.3.23.jar!/:5.3.23]
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) ~[spring-beans-5.3.23.jar!/:5.3.23]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.3.23.jar!/:5.3.23]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) ~[spring-beans-5.3.23.jar!/:5.3.23]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) ~[spring-beans-5.3.23.jar!/:5.3.23]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:955) ~[spring-beans-5.3.23.jar!/:5.3.23]
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:918) ~[spring-context-5.3.23.jar!/:5.3.23]
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:583) ~[spring-context-5.3.23.jar!/:5.3.23]
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:734) ~[spring-boot-2.7.5.jar!/:2.7.5]
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:408) ~[spring-boot-2.7.5.jar!/:2.7.5]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:308) ~[spring-boot-2.7.5.jar!/:2.7.5]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1306) ~[spring-boot-2.7.5.jar!/:2.7.5]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1295) ~[spring-boot-2.7.5.jar!/:2.7.5]
    at de.dvdgeisler.iot.dirigera.client.mqtt.DirigeraClientMqttApplication.main(DirigeraClientMqttApplication.java:98) ~[classes!/:0.0.1-SNAPSHOT]
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[na:na]
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
    at java.base/java.lang.reflect.Method.invoke(Method.java:568) ~[na:na]
    at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:49) ~[dirigera-client-mqtt.jar:0.0.1-SNAPSHOT]
    at org.springframework.boot.loader.Launcher.launch(Launcher.java:108) ~[dirigera-client-mqtt.jar:0.0.1-SNAPSHOT]
    at org.springframework.boot.loader.Launcher.launch(Launcher.java:58) ~[dirigera-client-mqtt.jar:0.0.1-SNAPSHOT]
    at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:65) ~[dirigera-client-mqtt.jar:0.0.1-SNAPSHOT]

From here it just endlessly repeats itself.

maxeitelwein commented 5 months ago

I had the wrong IP set for the MQTT Broker. It is running now with the updated Broker IP.