Nibe Heatpump problem

Hi
I have a Nibe VVM310 heatpump and want to get information via the Nibe bindeng for OLpenhab2.
I testet the software for Aruduino supplied with the binding, but had some problems being that the heatpump went into errormode after a while. Somtimes a few minutes - somtimes several hours.
I also have a Solar adapter connected to the heatpump, at it is using the same RS485 line for communication.
I have the same problem with error mode when only using the solar adapter, but this is once or twice a month.
Nibe was not able to come up with a solution, and now when I connnect the Modbus unit the problem comes all the time(reporting error on the modbus).
I rewrote the Arduino code to work with ESP8266 and at the same time simplified the code - without any improvemt to my problem.
I enclose the code for my ESP8266:
File NibeGW_5.ino

//------------------------------------
#include <WiFiUdp.h>
#include <ArduinoOTA.h>
#include “nibe.h” Same as above

WiFiUDP udp9999;

NIBE nibe(2, 0x20); // pin 2, ADDR=0x20

IPAddress udp_ip(192, 168, 1, 39);
unsigned int udp_port = 50000;
unsigned int port9999 = 9999;

void setup() {
WiFi.begin("…", “…”);
while (WiFi.status() != WL_CONNECTED) delay(500);
nibe.onData([](char* data, int len) {
udp9999.beginPacket(“192.168.1.39”, port9999);
udp9999.write(data, len);
udp9999.endPacket();
});
nibe.begin();
ArduinoOTA.begin();
}

void loop() {
ArduinoOTA.handle();
nibe.loop();
delay(1);
}
//------------------------------------------
File nibe.h
//------------------------------------------
#ifndef class_nibe
#define class_nibe

typedef void (*nibeOnData)(char * buffer, int len);
typedef void (*nibeOnPublish)(unsigned int key, int value);

class NIBE {
private:
uint8_t directionPin = 2;
uint8_t verbose = 0;
byte ADDR = 0x20;
byte buffer[255];
int pos = 0;
byte crc = 0;
nibeOnData f_onData;
nibeOnPublish f_onPublish;
void doPublish(char * data, int len) {
int l = len - 2;
for (int i = 5; i < l; i++) {
if (((i - 5) % 4) == 0) {
unsigned int key = data[i] + (data[i + 1] << 8);
if (key != 65535) {
int value = data[i + 2] + (data[i + 3] << 8);
if (f_onPublish) f_onPublish(key, value);
}
}
}
}
void sendAck() {
digitalWrite(directionPin, HIGH);
delay(1);
Serial.write(0x06);
Serial.flush();
delay(1);
digitalWrite(directionPin, LOW);
}
void sendNack() {
digitalWrite(directionPin, HIGH);
delay(1);
Serial.write(0x15);
Serial.flush();
delay(1);
digitalWrite(directionPin, LOW);
}
public:
NIBE(uint8_t pin, byte _ADDR) {
directionPin = pin;
ADDR = _ADDR;
}
void onData(nibeOnData x_cb) {
f_onData = x_cb;
}
void onPublish(nibeOnPublish x_cb) {
f_onPublish = x_cb;
}
void begin() {
wdt_enable (WDTO_1S);
pinMode(directionPin, OUTPUT);
digitalWrite(directionPin, LOW);
Serial.begin(9600, SERIAL_8N1);
}
void loop() {
wdt_reset ();
if (Serial.available() > 0) {
byte b = Serial.read();
if (b == 0x5c) if (pos < 4) pos = 0;
if (pos >= 100) pos = 0;
if (pos < 2) crc = 0x00;
else crc ^= b;
buffer[pos++] = b;
if ((pos == 2) && (b != 0x00)) pos = 0; // 0x00 in pos 1
if ((pos == 3) && (b != ADDR)) pos = 0; // ADDR in pos 2
if (pos > 4) {
if (buffer[4] == (pos - 6)) {
if (crc == 0) {
sendAck();
if (buffer[0] == 0x5C && buffer[1] == 0x00 && buffer[2] == ADDR && buffer[3] == 0x68 && buffer[4] >= 0x50) {
if (f_onData) f_onData((char*)buffer, pos);
else doPublish((char*)buffer, pos);
}
} else sendNack();
pos = 0;
}
}
}
}
};

#endif
//------------------------------------------

Does anyone have any experience with this or can anyone point me in the right directiron?
Tnx in advance.
Erik