1
0

do stuff only for DataPoints who have a register

This commit is contained in:
Rémi Heredero 2023-06-11 18:33:44 +02:00
parent f170d6f8b9
commit 0fdcbba01b

View File

@ -95,6 +95,8 @@ public class FieldConnector implements DataPointListener {
@Override @Override
public void onNewValue(DataPoint dp) { public void onNewValue(DataPoint dp) {
ModbusRegister mR = ModbusRegister.getRegisterFromDatapoint(dp); //search the corresponding register to the datapoint ModbusRegister mR = ModbusRegister.getRegisterFromDatapoint(dp); //search the corresponding register to the datapoint
if(mR == null) return; //if the register is not found, return
if(dp.isOutput()){ //write only on the datapoints, which are outputs if(dp.isOutput()){ //write only on the datapoints, which are outputs
if(dp.getLabel().equals("REMOTE_SOLAR_SW") //write only boolean outputs if(dp.getLabel().equals("REMOTE_SOLAR_SW") //write only boolean outputs
||dp.getLabel().equals("REMOTE_WIND_SW") ||dp.getLabel().equals("REMOTE_WIND_SW")