question

kstyler avatar image
kstyler asked

Beginner Question: Function for Shore Power to GX Relay

Hello, I would like to switch my relay on the Cerbo GX if the multiples is connected to shore power?

I've started in node Red but I am not sure which measurement from the Multiplus indicates if it is connect to shore power? An which value should be in the function 1, 2 or 240?


bildschirmfoto-2023-11-16-um-170638.png



Relayshorepower
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

3 Answers
derrick thomas avatar image
derrick thomas answered ·

A multiplus only has one ac input. Value 1 and 240 would apply to your situation.

2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

kstyler avatar image
kstyler answered ·

Thanks, Value 0 says it is connected and 240 says it is not?

1 comment
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

derrick thomas avatar image derrick thomas commented ·
Correct
0 Likes 0 ·
kstyler avatar image
kstyler answered ·

Could you help me with the function?


bildschirmfoto-2023-11-16-um-214303.png


2 comments
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

matt1309 avatar image matt1309 commented ·

Hi @Kstyler


You could use the switch and change nodes to achieve this i believe.

What you'll want is something like this, double check the 1, 240, 0 and 1 are in the right place but the structure of it should wrk.



if(msg.payload == 1){

return 1; //whatever you want to output

} else if (msg.payload == 240){

return 0; //whatever you want to output

}



0 Likes 0 ·
kstyler avatar image kstyler matt1309 commented ·

Could make it work with a function, thanks.Bildschirmfoto 2023-11-17 um 21.31.24.png

if (msg.payload == 0) {
    node.warn("Shore Power" + msg.payload)
    msg.payload=1
    return msg
}
else  {
    node.warn("Shore Power Off" + msg.payload)
    msg.payload=0
    return msg
}
0 Likes 0 ·

Related Resources

Additional resources still need to be added for this topic