Victron modbus switch control

Hey all,

So ive got venus os installed on a raspberry pi to connect with my victron equipment, it communicates over modbus and ive got it reading the info i need fine, only thing is i want to make a switch that will write to a modbus register and not sure how to do it, the switch state is either 0 - off ,1- on when read as a modbus value, can anyone advise how i would create the switch that would alternate between 0 and 1

Did you ever figure this out trying to do the same thing

thanks