Skip to content

Commit

Permalink
fix(vendor.dreame): Handle some previously unhandled messages
Browse files Browse the repository at this point in the history
  • Loading branch information
Hypfer committed Jun 20, 2021
1 parent 26d8a4c commit 810a212
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
7 changes: 7 additions & 0 deletions backend/lib/miio/Dummycloud.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,14 @@ class Dummycloud {
});
return;
}

if (!this.onMessage(msg)) {
//TODO: figure out why we're receiving "{"result":["ok"]}" messages
if (Array.isArray(msg?.result) && msg.result[0] === "ok") {
return;
}


Logger.info("Unknown cloud message received:", JSON.stringify(msg));

//TODO: send default cloud ack!
Expand Down
12 changes: 12 additions & 0 deletions backend/lib/robots/dreame/DreameGen2ValetudoRobot.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,14 @@ const stateAttrs = entities.state.attributes;
//This is taken from the D9 MIOT spec but it applies to many more
//https://miot-spec.org/miot-spec-v2/instance?type=urn:miot-spec-v2:device:vacuum:0000A006:dreame-p2009:1
const MIOT_SERVICES = Object.freeze({
DEVICE: {
SIID: 1,
PROPERTIES: {
SERIAL_NUMBER: {
PIID: 5
}
}
},
VACUUM_1: {
SIID: 2,
PROPERTIES: {
Expand Down Expand Up @@ -478,6 +486,10 @@ class DreameGen2ValetudoRobot extends DreameValetudoRobot {
case MIOT_SERVICES.FILTER.SIID:
this.parseAndUpdateState([e]);
break;
case MIOT_SERVICES.DEVICE.SIID:
case 99: //This seems to be a duplicate of the device service
//Intentionally ignored
break;
default:
Logger.warn("Unhandled property change ", e);
}
Expand Down

0 comments on commit 810a212

Please sign in to comment.