Dirk SV MOIN - Hi, I am new to Node Red and how...
Hi, I am new to Node Red and how to interact with SignalK data.
What I would love to do:
Telegam Chatbot receives /SOC and sents electrical.batteries.0.capacity.stateOfCharge back.
Is there a node where I "only" can read data? The SingalK-Subscribe node permanently sents data and this is not what I am looking for, I am looking for return value when asked for it. Thanks a lot.
4 Replies
in a function you can do this:
Thanks a lot, seems I have to find now how to convert a number to a string 🙂
hmm, seems "volts" is an object. how can I access it's value?
volts.value
or wait
see in my example above? the path?
make sure you have .value
Thanks, that was the trick. It seems not to be niced code, but this works:
let app = global.get('app')
let soc = app.getSelfPath('electrical.batteries.0.capacity.stateOfCharge.value')
let res = Math.round(soc*100);
let res2 = res.toFixed(0);
res2 += "% State of Charge";
msg.payload.content = res2;
return msg;