ray_sabado - I'm guessing this is super basic b...

I'm guessing this is super basic but I can't figure it out. I'm trying to take our fuel tank level that is in m3 and convert it to gallons and write it to a new path in Signalk. Everything is working except writing I back to SK. I can't figure out how to write to a new path. I tried to use send path value but it simply writes the value in gallons to the same path causing a loop of always increasing levels. How can I write to a completely new path name such as nr.tanks.fuel.gallons.port?
8 Replies
Scott Bender
Scott Bender2mo ago
You need to rewrite the "topic" of the message but this does not make any sense the client side shoudl be converting to your prefered units we keep units standard in sk for a reason not the same, but an example of a function that sends a new path
let _ = global.get('lodash')
let app = global.get('app')

let volts = app.getSelfPath('electrical.batteries.house.voltage.value')


if ( !_.isUndefined(volts) ) {
return { payload: msg.payload / volts, topic: 'electrical.venus.dcCurrent'}
}
let _ = global.get('lodash')
let app = global.get('app')

let volts = app.getSelfPath('electrical.batteries.house.voltage.value')


if ( !_.isUndefined(volts) ) {
return { payload: msg.payload / volts, topic: 'electrical.venus.dcCurrent'}
}
the next node is send-pathvalue see how I specify the "topic"?
ray_sabado
ray_sabadoOP2mo ago
I'm trying to send the fuel and water levels to Saillogger. They don't seem to have the ability to change the units.
Scott Bender
Scott Bender2mo ago
I think they do? If I recall, it's hard to find. But it's there or maybe they don't have for volume? do you have "Use Imperial Units" on?
Scott Bender
Scott Bender2mo ago
No description
ray_sabado
ray_sabadoOP2mo ago
Yes, that is selected.
Ilker
Ilker3w ago
Sorry, catching up here late. What is the issue here @ray_sabado ?
ray_sabado
ray_sabadoOP3w ago
Hey, hope everything is going well. It's not really an issue. We were just looking for a way to send our fuel tank levels to saillogger. Our weather router likes to track fuel levels in ocean crossing. Sailloger just reports those values as m3 and I was hoping to have it display in either liters or gallons instead.
Ilker
Ilker3w ago
Ah, yeah it needs a volume unit!
Want results from more Discord servers?
Add your server