alexkn / node-red-contrib-valetudo

A Node-RED node to convert Valetudo map_data to a png image wich can be send to a dashboard template node.
Apache License 2.0
14 stars 2 forks source link

Node-RED keeps hanging after adjusting Crop #4

Closed nicedevil007 closed 4 years ago

nicedevil007 commented 4 years ago

Hey Alex :)

I build everything new from ground up and now it was time to setup valetudo again. Unfurtunately I didn't know the right crop settings of my previous installation. So I started and testing. After I adjusted the y1 my node-red keeps bootlooping with that error:

Welcome to Node-RED,
===================
26 Dec 12:52:42 - [info] Node-RED version: v1.0.3,
26 Dec 12:52:42 - [info] Node.js  version: v12.14.0,
26 Dec 12:52:42 - [info] Linux 4.19.75-v7l+ arm LE,
26 Dec 12:52:43 - [info] Loading palette nodes,
26 Dec 12:52:46 - [info] Dashboard version 2.19.3 started at /ui,
26 Dec 12:52:47 - [info] Settings file  : /data/settings.js,
26 Dec 12:52:47 - [info] Context store  : 'default' [module=localfilesystem],
26 Dec 12:52:47 - [info] User directory : /data,
26 Dec 12:52:47 - [warn] Projects disabled : editorTheme.projects.enabled=false,
26 Dec 12:52:47 - [info] Flows file     : /data/flows.json,
26 Dec 12:52:47 - [info] Server now running at http://127.0.0.1:1880/,
26 Dec 12:52:47 - [info] Starting flows,
26 Dec 12:52:48 - [info] Started flows,
26 Dec 12:52:48 - [info] [mqtt-broker:Mosquitto] Connected to broker: mqtt://172.2.0.2:9883,
26 Dec 12:52:49 - [red] Uncaught Exception:,
26 Dec 12:52:49 - RangeError [ERR_BUFFER_OUT_OF_BOUNDS]: Attempt to access memory outside buffer bounds,
    at boundsError (internal/buffer.js:70:11),
    at checkBounds (internal/buffer.js:41:5),
    at checkInt (internal/buffer.js:60:3),
    at writeU_Int32BE (internal/buffer.js:788:3),
    at Buffer.writeUInt32BE (internal/buffer.js:801:10),
    at Jimp.setPixelColor (/data/node_modules/@jimp/core/dist/index.js:893:24),
    at drawPixel (/data/node_modules/node-red-contrib-valetudo/lib/Tools.js:67:35),
    at Array.forEach (<anonymous>),
    at /data/node_modules/node-red-contrib-valetudo/lib/Tools.js:65:61,
    at Array.forEach (<anonymous>),
    at Jimp.<anonymous> (/data/node_modules/node-red-contrib-valetudo/lib/Tools.js:62:65),
    at Timeout._onTimeout (/data/node_modules/@jimp/core/dist/index.js:339:25),
    at listOnTimeout (internal/timers.js:531:17),
    at processTimers (internal/timers.js:475:7),
npm ERR! code ELIFECYCLE,
npm ERR! errno 1,
npm ERR! node-red-docker@1.0.3 start: `node $NODE_OPTIONS node_modules/node-red/red.js $FLOWS "--userDir" "/data"`,
npm ERR! Exit status 1,,
 ,
npm ERR! Failed at the node-red-docker@1.0.3 start script.,
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.,
,
npm ERR! A complete log of this run can be found in:,
npm ERR!     /usr/src/node-red/.npm/_logs/2019-12-26T11_52_49_257Z-debug.log,
alexkn commented 4 years ago

I don't know what exactly goes wrong, but error handling in Tools.js is not really good. I'll fix that later.

However, the code should only be called when Valetudo sends map data. If you shutdown your vacuum or deactivate mqtt, Node-Red should no longer crash and you can change the crop settings.

Please write here the crop settings that you had set before it crashed.

nicedevil007 commented 4 years ago

If I remember right, I set it to this values:

x1=75 x2=0 y1=75 y2=0

nicedevil007 commented 4 years ago

Ok was able to set it to correct values to fit in a huge window.

Is there a way to make this png smaller in valetudo so it don't need that much space? Or even better, could we just rotate the png?

alexkn commented 4 years ago

Is there a way to make this png smaller in valetudo so it don't need that much space? Or even better, could we just rotate the png?

For rotating you can use a node for image manipulation like node-red-contrib-image-tools

nicedevil007 commented 4 years ago

That won't work, tested this one out :/

image

EDIT: Same happens on the rotate node.

EDIT2: Everything is working. Just have to use the manipulation node before Base64 node. image

nicedevil007 commented 4 years ago

Just want to let you know that node-red didn't crash in these tests anymore (I didn't disabled mqtt for this time, just made a backup of all my flows).