How to send Modbus Values to Solarfocus Heatpump via NodeRed

Hi,

I try to send external temperature via NodeRod to a Modbus Register in my Solarfocus VampAir Heatpump.

It works perfectly fine for positive numbers, but does not work for negative numbers:
This is how it works for positive:

let temp = 280;             //  *10
let buf = Buffer.alloc(2);           // 2 Byte = 16 Bit
buf.writeInt16BE(temp);              // big-endian 

msg.topic = 'Temperature';
msg.payload = {
    value: buf,
    fc: 16,
    address: 33406,
    quantity: 2
}
return msg;

but if I set 280 to -280, the heatpump does not react and does not do anything.
Does anybody have an idea ?

What node are you using for the modbus communication?

I am using the Modbus-Flex-Write node

Hi .. writing the buf as you do is not correct

because in the node's documentation it says :

For FC 6, msg.payload must be a single value between 0:65535. For FC 16, msg.payload must be an array of comma separated values between 0:65535 each.

I believe you need to convert the signed int to an unsigned int.
Also why you had quantity 2 ? since you are writing only 1 register ?

Try:

let temp = -280;             //  *10
let buf = Buffer.alloc(2);           // 2 Byte = 16 Bit
buf.writeInt16BE(temp);              // big-endian

msg.topic = 'Temperature';
msg.payload = {
    value: buf.readUInt16BE(),
    fc: 6,
    address: 33406,
    quantity: 1
}
return msg;

I just tried your version, but I get an error that says

""Error: Modbus exception 1: Illegal function (device does not support this read/write function)"

The definition of the Register I want to write looks like this:

image

and if I send a positive value it works fine .... but unfortunately it does not for negative values

.. strange that it doesnt support FC6 .. try FC16 like you had before

msg.payload = {
    value: buf.readUInt16BE(),
    fc: 16,
    address: 33406,
    quantity: 1
}

now I get this error message:

"Error: Quantity should be less or equal to register payload array length: undefined Addr: 33406 Q: 1"

ah yes ... value should have been an array for fc16 .. value: [ buf.readUInt16BE() ],

This is the object that is sent now with your latest proposal:

what happens on the receiver side is, that the value is set back to "default" - means that the value is taken again from the temperature sensor itself instead of my "feeding" process

if I send a positive value (e.g. 35) it works perfectly fine

it mentions in the description for that register that it needs to be updated every 30min.
could that be the cause ? based on this i wanted to clarify .. does the negative value ever get written .. but gets replaced by the temp. sensor later on ? (when you write the negative value, did you immediately try to do a read of 33406 to confirm ?)

image

In your screenshot of the register (at least in the german version of the manual) there seems to be firmware number v20.110 .. did you check if your device is up to date ?

Try contacting Solarfocus technical support because from the modbus communication side of things everything looks ok.

no, the negtaive qty never gets written - it does not change if I send a negative value
and it immediately changes if I send a positive on
after 30 minutes without sending a value is is set back to default and the integrated sensor is sending its data again

the heatpump was installed a few days ago, so my assumption was that I got the latest firmware version :blush:

It may will have been manufactured a year ago.

the active firmware is 24.x
the documentation is requiring 20.x
that should be fine ...