I’m reading the JSON received by TCP but when I try to send a command, like setdigout 1?0 , don’t do nothing!
Here is a example code:
socket.write(Buffer.from(({ "CMD": "setdigout 1?0" }).toString('hex'), "hex"));
socket.on('data', (data) => {
data = Buffer.from(data, "hex").toString('utf8').trim();
if(data.length <= 15) {
console.log(data.length);
console.log(data);
} else {
data = JSON.parse(JSON.stringify(data));
console.log(data);
}
});