-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Air Purufuer error and dump #79
Comments
It seems like the MQTT handler for HASS is trying to initiate your airpurifier as a motion sensor. |
Is it possible to ignore air purifier at all as a temporary workaround? |
To be fair we could take out the motion sensor completely. It's not yet working for an unknown reason. That might solve your issue |
Yes, better to ignore non-working devices/functions anyway. |
Removed the motion sensor. Try it out (Hass addon has been updated to 2023.5.1) |
Still same error. Full crop below. 2023-05-10 14:41:38.125 INFO 3138309 --- [ main] .d.i.d.c.m.DirigeraClientMqttApplication : Starting DirigeraClientMqttApplication v0.0.1-SNAPSHOT using Java 17.0.6 on puppy with PID 3138309 (/home/sbernard/work/DirigeraClient/dirigera-client-mqtt.jar started by sbernard in /home/sbernard/work/DirigeraClient) org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hassBlindsDeviceEventHandler' defined in URL [jar:file:/home/sbernard/work/DirigeraClient/dirigera-client-mqtt.jar!/BOOT-INF/classes!/de/dvdgeisler/iot/dirigera/client/mqtt/hass/HassBlindsDeviceEventHandler.class]: Bean instantiation via constructor failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [de.dvdgeisler.iot.dirigera.client.mqtt.hass.HassBlindsDeviceEventHandler]: Constructor threw exception; nested exception is org.springframework.core.codec.CodecException: Type definition error: [simple type, class de.dvdgeisler.iot.dirigera.client.api.model.device.airpurifier.AirPurifierFilterAttributes]; nested exception is com.fasterxml.jackson.databind.exc.InvalidDefinitionException: Cannot construct instance of 2023-05-10 14:41:58.156 DEBUG 3138309 --- [or-http-epoll-7] d.d.i.dirigera.client.api.WebSocketApi : Received Dirigera event: type=LAST_MODIFIED, id=089579d8-e241-411c-b177-2484d263979d, source=hub, time=2023-05-10T11:41:58.120 |
#79 Add air purifier to MQTT Hass code
I guess trying to add a rudimentary air purifier to HASS might solve the issue. Version 2023.5.2 is building. Fingers crossed that solves the issue Version 2023.5.2 is available |
Seems still same error. org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hassOutletDeviceEventHandler' defined in URL [jar:file:/home/sbernard/work/DirigeraClient/dirigera-client-mqtt.jar!/BOOT-INF/classes!/de/dvdgeisler/iot/dirigera/client/mqtt/hass/HassOutletDeviceEventHandler.class]: Bean instantiation via constructor failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [de.dvdgeisler.iot.dirigera.client.mqtt.hass.HassOutletDeviceEventHandler]: Constructor threw exception; nested exception is org.springframework.core.codec.CodecException: Type definition error: [simple type, class de.dvdgeisler.iot.dirigera.client.api.model.device.airpurifier.AirPurifierFilterAttributes]; nested exception is com.fasterxml.jackson.databind.exc.InvalidDefinitionException: Cannot construct instance of |
Guess I need to start analysing why the f this happens |
Seems I was able to get it running. I'm too newb to publish patches, but here what I did:
|
2023-05-10 22:39:07.848 INFO 7668 --- [ main] .d.i.d.c.m.DirigeraClientMqttApplication : Starting DirigeraClientMqttApplication using Java 17.0.7 on BOXW with PID 7668 (C:\work\DirigeraClient\dirigera-client-mqtt\target\classes started by sbr20 in C:\work\DirigeraClient) |
@sbr2004 I'll check it out and patch it asap. Thanks for pointing me into the right direction :) |
Seems that possible fan modes (from air purifier dump) could be: "fanModeSequence" : "lowMediumHighAuto", |
Just adjusted that in the code |
@sbr2004 Could you try out the latest development release when it's done to see if this fixes the issue. Since I don't have the air purifier myself to test |
Did a dump of various AirPurifier modes: OFF in IKEA APP:
AUTO in APP:
MANUAL speed 1 in APP:
MANUAL speed 2 in APP:
MANUAL speed 3 in APP:
MANUAL speed 5 in APP:
|
Fanmodes should now be correct. Not sure if I need to also set the motor state when setting the fanmode for HASS functionality to work but at least this should prevent the application from throwing errors (I hope) |
Tried development build. Works until I touch airpurifier in IKEA app, after that freezes, had to kill -9 process. Last several lines: 2023-05-11 10:13:45.239 DEBUG 3266187 --- [or-http-epoll-3] d.d.i.dirigera.client.api.WebSocketApi : Received Dirigera event: type=LAST_MODIFIED, id=c96ab713-13ea-4d3d-a8f8-60fe84dc0819, source=hub, time=2023-05-11T07:13:45.238 ^C^C^C^C^C ^C^C^CKilled |
It received the device update but it seems to not have the attributes of what changed |
strace of frozen process (200%CPU) strace -f -p 3266837 |
The weird part is, it did exactly what it had to do when the state changed event came in. There seems to be no reason for it to hang itself |
Update - freezes as soon as I switch purifier into manual mode in IKEA app. Switching between OFF/AUTO is ok and published to mqtt. 2023-05-11 10:37:19.561 DEBUG 3268904 --- [or-http-epoll-7] d.d.i.dirigera.client.api.WebSocketApi : Received Dirigera event: type=DEVICE_STATE_CHANGED, id=7fed5325-c0ff-4d92-9246-d8681b8aa68e, source=urn:com:ikea:homesmart:iotc:zigbee, time=2023-05-11T10:37:19 2023-05-11 10:37:20.414 DEBUG 3268904 --- [or-http-epoll-7] d.d.i.dirigera.client.api.WebSocketApi : Received Dirigera event: type=LAST_MODIFIED, id=1a1c1a71-cf39-4a13-b15e-c336e9f74bc6, source=hub, time=2023-05-11T07:37:20.414 2023-05-11 10:37:21.805 DEBUG 3268904 --- [or-http-epoll-7] d.d.i.dirigera.client.api.WebSocketApi : Received Dirigera event: type=DEVICE_STATE_CHANGED, id=02706cc7-df26-4d29-8559-8b7d0862e9c8, source=urn:com:ikea:homesmart:iotc:zigbee, time=2023-05-11T10:37:21 2023-05-11 10:37:26.533 DEBUG 3268904 --- [or-http-epoll-7] d.d.i.dirigera.client.api.WebSocketApi : Received Dirigera event: type=DEVICE_STATE_CHANGED, id=4825116b-9c15-4be0-a372-f82b2151627f, source=urn:com:ikea:homesmart:iotc:zigbee, time=2023-05-11T10:37:26 |
That seems like the manual mode isn't completely correct yet but I don't see the reason why.... |
Where is it in source? I can also take a look :) |
got it going. there is also ON mode for airpurifier. But strange app freeze instead of throwing an error. Log only continues after pause/resume app in debugger. Fix: AirPurifierFanMode.java: HassAirPurifierEventHandler.java: config.payload_on = this.toJSON(AirPurifierFanMode.ON); log: 2023-05-11 20:15:25.303 ERROR 20952 --- [-1fc80ec3ad50_1] .d.i.d.c.m.DirigeraClientMqttApplication : Connection lost to MQTT broker: Connection lost |
I added the ON state. Could you retest this? |
Now seems to be good, thanks! Also home assistant does not support air purifier: WARNING (MainThread) [homeassistant.components.mqtt.discovery] Integration air_quality is not supported PS freeze on unknown value is not good, app should provide error or crash at least. :) |
I definitely agree but I'm not the original creator and still don't have the full grasps of what the code is doing on the background. I might be a software developer by career choice, I still need time to figure things out. And great to see the home assistant components documentation is up to date. I'll try changing it to a fan in this case |
There is also PM25 sensor in purifier, perhaps it could be published into mqtt. Attribute "currentPM25" |
I'll look into that next but first lets get the basic function working :) |
It's something at least. I see that it's now running in optimistic mode (meaning only on and off). Let's see if that actually lets you control what we want to control |
OFF/MANUAL fan modes work from home assistant. What we achieved is that home assistant dirigera integration finally works in an environment with (^&#$) air purifier. :) |
I'll create a release for that and see if I can make the functionality so you can actually control it with home assistant :) |
I'm now running client on test box, will try in home assistant as soon as you release. |
Updated the addon. Will see what I can do about the functionality of the air purifier in home assistant |
All is good, home assistant addon running. |
Unfortunately home assistant plugin did not survive overnight, now each mqtt publish thwors an error into logs: 2023-05-12 10:37:16.149 ERROR 66 --- [or-http-epoll-2] d.d.i.d.client.mqtt.MqttEventHandler : Error while publishing to MQTT topic: MqttException |
while changing brightness home assistant throws an error into log: 2023-05-12 23:26:10.846 ERROR (MainThread) [homeassistant.util.logging] Exception in state_received when handling msg on 'homeassistant/light/d5f4abd6-e263-480c-ae04-1fc80ec3ad50_1/de204e68-23eb-40d4-b3ab-53b6defcfcce_1/state': '{"brightness":46,"color":{}}' 2023-05-12 23:26:10.877 ERROR (MainThread) [homeassistant.util.logging] Exception in state_received when handling msg on 'homeassistant/light/d5f4abd6-e263-480c-ae04-1fc80ec3ad50_1/d719b113-fe3d-44f3-9fe7-6525d706452c_1/state': '{"brightness":55,"color":{}}' |
The error seems to be unrelated to this issue. |
It is possible to switch air purifier from home assistant only between OFF and MANUAL modes. Also got mqtt exception: 2023-05-16 15:23:24.300 DEBUG 4087535 --- [or-http-epoll-7] d.d.i.d.c.m.hass.HassDeviceEventHandler : Received device state changed event: {"deviceType":"airPurifier","id":"e19c9cde-54aa-4dbd-a354-d3034eab384b_1","type":"airPurifier","deviceType":"airPurifier","createdAt":"2022-12-02T16:03:02","isReachable":true,"lastSeen":"2023-05-16T15:23:24","attributes":{"fanMode":"off","fanModeSequence":"lowMediumHighAuto","motorState":0,"filterElapsedTime":null,"filterAlarmStatus":null,"filterLifetime":null,"otaStatus":null,"otaState":null,"otaProgress":null,"otaScheduleStart":null,"otaScheduleEnd":null,"otaPolicy":null},"remoteLinks":[]} |
Hmm this change should have brought some more controls to the FAN. |
No extra fields, just ON/OFF |
I get the following error while starting mqtt client:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hassMotionSensorDeviceEventHandler' defined in URL [jar:file:/home/sbernard/work/DirigeraClient/dirigera-client-mqtt.jar!/BOOT-INF/classes!/de/dvdgeisler/iot/dirigera/client/mqtt/hass/HassMotionSensorDeviceEventHandler.class]: Bean instantiation via constructor failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [de.dvdgeisler.iot.dirigera.client.mqtt.hass.HassMotionSensorDeviceEventHandler]: Constructor threw exception; nested exception is org.springframework.core.codec.CodecException: Type definition error: [simple type, class de.dvdgeisler.iot.dirigera.client.api.model.device.airpurifier.AirPurifierFilterAttributes]; nested exception is com.fasterxml.jackson.databind.exc.InvalidDefinitionException: Cannot construct instance of
de.dvdgeisler.iot.dirigera.client.api.model.device.airpurifier.AirPurifierFilterAttributes
(no Creators, like default constructor, exist): cannot deserialize from Object value (no delegate- or property-based Creator)at [Source: (io.netty.buffer.ByteBufInputStream); line: 1, column: 4699] (through reference chain: java.util.ArrayList[3]->de.dvdgeisler.iot.dirigera.client.api.model.device.airpurifier.AirPurifierDevice["attributes"])
Below is crop from dump:
{
"id" : "e19c9cde-54aa-4dbd-a354-d3034eab384b_1",
"type" : "airPurifier",
"deviceType" : "airPurifier",
"createdAt" : "2022-12-02T16:03:02.000Z",
"isReachable" : true,
"lastSeen" : "2023-04-24T14:30:44.000Z",
"attributes" : {
"customName" : "Air purifier 1",
"model" : "STARKVIND Air purifier",
"manufacturer" : "IKEA of Sweden",
"firmwareVersion" : "1.1.001",
"hardwareVersion" : "1",
"serialNumber" : "2C1165FFFE18F406",
"productCode" : "E2007",
"fanMode" : "low",
"fanModeSequence" : "lowMediumHighAuto",
"motorState" : 25,
"motorRuntime" : 201495,
"filterElapsedTime" : 205983,
"filterAlarmStatus" : false,
"filterLifetime" : 259200,
"childLock" : false,
"statusLight" : true,
"currentPM25" : 9,
"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", "fanMode", "fanModeSequence", "motorState", "childLock", "statusLight" ]
},
The text was updated successfully, but these errors were encountered: