Hypfer / ICantBelieveItsNotValetudo

A Valetudo companion service which renders maps to pngs
Apache License 2.0
129 stars 80 forks source link

Not longer working with Valetudo 2021.01.1 #45

Closed sylvaindd closed 3 years ago

sylvaindd commented 3 years ago

It doesn't seem to be working with the new Valetudo version 2021.01.1.

image

SyntaxError: Unexpected token e in JSON at position 0
    at JSON.parse (<anonymous>)
    at MqttClient.<anonymous> (/app/lib/MqttClient.js:86:42)
    at MqttClient.emit (events.js:315:20)
    at MqttClient._handlePublish (/app/node_modules/mqtt/lib/client.js:1277:12)
    at MqttClient._handlePacket (/app/node_modules/mqtt/lib/client.js:410:12)
    at work (/app/node_modules/mqtt/lib/client.js:321:12)
    at Writable.writable._write (/app/node_modules/mqtt/lib/client.js:335:5)
    at doWrite (/app/node_modules/mqtt/node_modules/readable-stream/lib/_stream_writable.js:409:139)
    at writeOrBuffer (/app/node_modules/mqtt/node_modules/readable-stream/lib/_stream_writable.js:398:5)
    at Writable.write (/app/node_modules/mqtt/node_modules/readable-stream/lib/_stream_writable.js:307:11)

Unfortunatly I removed my old topic, but I guess the map_data was previously in JSON as it tries to parse it as JSON.

Hypfer commented 3 years ago

Yep the map data is deflated and base64 encoded (optional) now and needs to be inflated first

sylvaindd commented 3 years ago

I made it work without base64 encoding.

zlib.inflate(message, (err, result) => {
  if(!err) {
    this.updateMapTopic(JSON.parse(result));
  } else {
    console.error(err);
  }
});

Tried this for base64 encoded, but didn't work :

zlib.inflate(Buffer.from(message, 'base64'), (err, result) => {
    if(!err) {
        this.updateMapTopic(JSON.parse(result));
    } else {
        console.error(err);
    }
});
Error: incorrect header check
    at Zlib.zlibOnError [as onerror] (zlib.js:182:17) {
  errno: -3,
  code: 'Z_DATA_ERROR'
}
deku-m commented 3 years ago

Having same issue with getting the map into home assistant Is there a workaround available in home assistant?

leonardpitzu commented 3 years ago

same for me

leonardpitzu commented 3 years ago

I sort of patched it but CPU and RAM usage are really high (about 25% CPU and 600MB RAM on a Synology 718+ NAS)...

Zaschii commented 3 years ago

any news/solution?

alexmorbo commented 3 years ago

Any news?

Zaschii commented 3 years ago

Are there any news how ICantBelieveItsNotValetudo can run with 2021.01.1?

Hypfer commented 3 years ago

Should be fixed by #46

mikispag commented 3 years ago

I made further improvements in my fork.

Feel free to port it back to upstream - in my fork, I decide to remove some features I don't need.

The fork:

Hypfer commented 3 years ago

@mikispag As far as I'm concerned, all these changes can be merged into this repo

mikispag commented 3 years ago

Oh, cool. Filed #47.

sylvaindd commented 3 years ago

Issue was fixed in #46

47 is working as well.

Thanks