Greetings!
I'm pretty new to this automation world, but since a month or so playing around with Home Assistant and Node-RED in my home on wheels.
I installed on a Raspberry Pi 4 4GB, Home Assistant in Docker and first also had Node-RED in a container, but didn't like that I can't write files outside of this container. So I installed Node-RED with the install script locally. Added node-red-contrib-home-assistant-websocket and installed with HACS the connection according to: https://bit.ly/3tductt
All on the same Pi.
Since I'm really not a programmer, but very enthusiastic learner, I asked around on the web how people got info's through.
A nice thing I like is temperature and locations, So I wanted to get my GPS location to be updated as my home location.
My electrical system is only made out of Victron chargers/inverters and a CCGX with an USB GPS connected.
Unfortunately the GPS is pretty unstable lately, but a new one is on it's way (from Germany to Greece)
Now the issue:
I'm getting via MQTT an message from the CCGX with my location.
Since I'm not able to write a javascript, I'm "Changing" and "Joining" the message until it's ready to send to the homeassistant.set_location service into Home Assistant.
[{"id":"859a6112.889c4","type":"tab","label":"GPS location","disabled":false,"info":""},{"id":"1ff89969.5dfcb7","type":"mqtt in","z":"859a6112.889c4","name":"Longitude","topic":"N/7c010a8eed8e/gps/0/Position/Longitude","qos":"2","datatype":"auto","broker":"f8ba937.ec033f","x":100,"y":140,"wires":[["1687ce5c.d1295a"]]},{"id":"f29b69e9.530d28","type":"mqtt in","z":"859a6112.889c4","name":"Latitude","topic":"N/7c010a8eed8e/gps/0/Position/Latitude","qos":"1","datatype":"auto","broker":"f8ba937.ec033f","x":90,"y":200,"wires":[["fe73062.86306f8"]]},{"id":"1687ce5c.d1295a","type":"change","z":"859a6112.889c4","name":"","rules":[{"t":"change","p":"payload","pt":"msg","from":"value","fromt":"str","to":"longitude","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":300,"y":140,"wires":[["8d207e09.6f965"]]},{"id":"fe73062.86306f8","type":"change","z":"859a6112.889c4","name":"","rules":[{"t":"change","p":"payload","pt":"msg","from":"value","fromt":"str","to":"latitude","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":300,"y":200,"wires":[["e7b526d1.a2b17"]]},{"id":"8d207e09.6f965","type":"json","z":"859a6112.889c4","name":"","property":"payload","action":"obj","pretty":false,"x":490,"y":140,"wires":[["9bd3eded.b29f6"]]},{"id":"e7b526d1.a2b17","type":"json","z":"859a6112.889c4","name":"","property":"payload","action":"obj","pretty":false,"x":490,"y":200,"wires":[["9bd3eded.b29f6"]]},{"id":"9bd3eded.b29f6","type":"join","z":"859a6112.889c4","name":"","mode":"custom","build":"merged","property":"payload","propertyType":"msg","key":"topic","joiner":"","joinerType":"str","accumulate":false,"timeout":"30","count":"2","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":660,"y":180,"wires":[["61487b0.821a104"]]},{"id":"3c72d85f.1e68e","type":"api-call-service","z":"859a6112.889c4","name":"","server":"161793d1.ba3dec","version":1,"debugenabled":false,"service_domain":"homeassistant","service":"set_location","entityId":"","data":"msg.payload","dataType":"jsonata","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":950,"y":280,"wires":[["8dfc5bcd.f785e"]]},{"id":"61487b0.821a104","type":"delay","z":"859a6112.889c4","name":"","pauseType":"delay","timeout":"2","timeoutUnits":"minutes","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":840,"y":180,"wires":[["3c72d85f.1e68e"]]},{"id":"8dfc5bcd.f785e","type":"debug","z":"859a6112.889c4","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":960,"y":360,"wires":[]},{"id":"f8ba937.ec033f","type":"mqtt-broker","name":"CCGX","broker":"192.168.0.52","port":"1883","clientid":"","usetls":false,"compatmode":false,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"161793d1.ba3dec","type":"server","name":"Home Assistant","legacy":false,"addon":false,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":false}]
Now the strange thing happens:
My Memory (RAM) is getting flood.
I found this out, because I had a couple of times a complete freeze of my Pi.
I narrowed the problem down by not running Node-RED (but with MQTT being on via MQTT sensors in Home Assistant), and then deleted this flow.
Without this flow all is fine. Memory is nice and stable.
I know this flow can be optimized with a function node, but I've no idea how...
Anyone out there who can help?