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

Lightgroups crash the application #104

Open maxeitelwein opened 2 months ago

maxeitelwein commented 2 months ago

Whenever lightbulbs are connected together in a lightgroup the application crashes. It then throws the following error, which repeats endlessly:

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]

My lightbulb in the application dump looks like this:

{
    "id" : "bdb75fd2-da04-4710-9bb7-feb9299a4bf1_1",
    "type" : "light",
    "deviceType" : "light",
    "createdAt" : "2023-08-27T15:32:43.000Z",
    "isReachable" : true,
    "lastSeen" : "2024-02-04T06:40:20.000Z",
    "attributes" : {
      "customName" : "Ecke3",
      "model" : "TRADFRIbulbE14WSglobeopal470lm",
      "manufacturer" : "IKEA of Sweden",
      "firmwareVersion" : "1.0.012",
      "hardwareVersion" : "1",
      "serialNumber" : "94DEB8FFFEF2330D",
      "productCode" : "LED2002G5",
      "isOn" : false,
      "startupOnOff" : "startOn",
      "lightLevel" : 60,
      "colorTemperature" : 2188,
      "colorTemperatureMin" : 4000,
      "colorTemperatureMax" : 2202,
      "startupTemperature" : -1,
      "colorMode" : "temperature",
      "identifyStarted" : "2000-01-01T00:00:00.000Z",
      "identifyPeriod" : 0,
      "permittingJoin" : false,
      "otaStatus" : "upToDate",
      "otaState" : "readyToCheck",
      "otaProgress" : 0,
      "otaPolicy" : "autoUpdate",
      "otaScheduleStart" : "00:00",
      "otaScheduleEnd" : "00:00"
    },
    "capabilities" : {
      "canSend" : [ ],
      "canReceive" : [ "customName", "isOn", "lightLevel", "colorTemperature" ]
    },
    "room" : {
      "id" : "7cffd2ff-2515-4a37-8d8b-9cf7438db118",
      "name" : "Schlafzimmer ",
      "color" : "ikea_yellow_no_24",
      "icon" : "rooms_bed"
    },
    "deviceSet" : [ {
      "id" : "9dcf0b97-ee29-43dd-8e06-093fad86db6b",
      "name" : "Eckenlicht",
      "icon" : "lighting_floor_lamp"
    } ],
    "remoteLinks" : [ ],
    "isHidden" : false
  }

Escpecially the part with deviceSet is important, it defines the lightgroup and is the part where the application crashes. When I remove the lightgroup from within the Ikea Home Smart App the application starts working just fine.