Ipx v3 node red

hello,

beginner, I trying to read status of relax output from an IPX v3
Payload command : GetOut1 (for the first relax)
Message payload :

* 14/3/2019 22:01:17[node: 3b85a382.bbe724](http://192.168.1.128:1880/#)msg : Object
* object
* _msgid: "85b585e6.1cda68"
* topic: ""
* payload: buffer[11][string](http://192.168.1.128:1880/#)
* GetOut2=1

I need to display a color box when GetOut2 = 1

Can you advice me ?
thanks

I am not entirely sure what that is showing, could you post a screenshot of the debug node output showing that payload please.

40

so the payload is a buffer and you need to change it to a string to be able to use in a switch node. One way to do that is to use a function node with something like this:

// move msg.payload to a variable 'buf'
var buf = msg.payload;
// convert 'buf' to a string
var str = buf.toString();
// move the string back to msg.payload
msg.payload = str;
// return the msg
return msg;

// this is a 'condensed' version
//msg.payload = msg.payload.toString();
//return msg;

Hello thanks for your help.
In my case, str could be GetIn1=0 or GetIn1=1 and I need two different action depending of str

Could you have an exemple ?
thanks,

If you only care that is is GetIn1=0 or GetIn1=1 then use a switch node.

If you need the value then use...

let v = str.split('=');
let val = v[1];

Since it is a string, you can compare for the exact string - I'd use a switch node

ok, it works.
after two days, dpi nodered doesn't start
19 Mar 21:16:17 - [info] Starting flows
19 Mar 21:16:17 - [info] Started flows
19 Mar 21:16:17 - [error] Unable to listen on http://127.0.0.1:1880/
19 Mar 21:16:17 - [error] Error: port in use

i'm lost

Port in use means that something else is using the port 1880. Normally this means Node-RED is already running.

flows are no more available in the web interface

nodered is running again but I have lost my previous flows and dashboard
Is there a way to retrieve my previous work ?
thanks,

That probably means you are running flows from a different location, possibly as a different user. What do you see in the terminal if you run

node-red-stop
node-red-start

Copy and paste the result here if possible.

pi@EURON8:~ $ node-red-start

Start Node-RED

Once Node-RED has started, point a browser at http://192.168.1.128:1880
On Pi Node-RED works better with the Firefox or Chrome browser

Use node-red-stop to stop Node-RED
Use node-red-start to start Node-RED again
Use node-red-log to view the recent log output
Use sudo systemctl enable nodered.service to autostart Node-RED at every boot
Use sudo systemctl disable nodered.service to disable autostart on boot

To find more nodes and example flows - go to http://flows.nodered.org

Starting as a systemd service.
Started Node-RED graphical event wiring tool.
20 Mar 07:29:55 - [info]
Welcome to Node-RED

20 Mar 07:29:55 - [info] Node-RED version: v0.18.7
20 Mar 07:29:55 - [info] Node.js version: v10.9.0
20 Mar 07:29:55 - [info] Linux 4.14.52-v7+ arm LE
20 Mar 07:29:56 - [info] Loading palette nodes
20 Mar 07:29:58 - [info] Dashboard version 2.14.0 started at /ui
20 Mar 07:29:59 - [info] Settings file : /home/pi/.node-red/settings.js
20 Mar 07:29:59 - [info] HTTP Static : /home/pi/Pictures
20 Mar 07:29:59 - [info] User directory : /home/pi/.node-red
20 Mar 07:29:59 - [warn] Projects disabled : editorTheme.projects.enabled=false
20 Mar 07:29:59 - [info] Flows file : /home/pi/.node-red/flows_EURON8.json
20 Mar 07:29:59 - [info] Server now running at http://127.0.0.1:1880/
20 Mar 07:29:59 - [warn]

Your flow credentials file is encrypted using a system-generated key.
If the system-generated key is lost for any reason, your credentials
file will not be recoverable, you will have to delete it and re-enter
your credentials.
You should set your own key using the 'credentialSecret' option in
your settings file. Node-RED will then re-encrypt your credentials
file using your chosen key the next time you deploy a change.

20 Mar 07:29:59 - [info] Starting flows
20 Mar 07:29:59 - [info] Started flows

no more flows

You are using an old version of Node-RED so after you have fixed your issue it would be worth while updating.

In a terminal cd into /home/pi/.node-red/

list the files that begging with flows using

ls -lart flows*

what files are listed?

Have you recently changed the host name of the pi to EURON8? If so then @ukmoose's suggestion will show the old flow.

pi@EURON8 : ~/.node-red $ ls -lart flows*

-rw-r--r-- 1 pi pi 136 sep 9 2018 flows_PLATE_cred.json

-rw-r--r-- 1 pi pi 6707 sep 9 2018 flows_PLATE.json

-rw-r--r-- 1 pi pi 44 mar 19 20:07 flows_EURON8_cred.json

-rw-r--r-- 1 pi pi 2 mar 20 18:46 flows_EURON8.json

pi@EURON8 : ~/.node-red $

so you have another flow file flows_PLATE.json
the documentation explains how to specify which flows file you start Node-RED with

strange because I didm't change the host name of the pi

is the settings.js file used to specify the flow when we start Node-Red ?

I retrieved old flows (september) but not the flows confiture recently.
I think I will reinstalled the pi
Thanks for your help