def write_single_coil(self, slave_addr, output_address, output_value): modbus_pdu = functions.write_single_coil(output_address, output_value) response = self._send_receive(slave_addr, modbus_pdu, False) operation_status = functions.validate_resp_data(response, Const.WRITE_SINGLE_COIL, output_address, value=output_value, signed=False) return operation_status
def write_multiple_coils(self, slave_addr, starting_address, output_values): modbus_pdu = functions.write_multiple_coils(starting_address, output_values) response = self._send_receive(slave_addr, modbus_pdu, False) operation_status = functions.validate_resp_data(response, Const.WRITE_MULTIPLE_COILS, starting_address, quantity=len(output_values)) return operation_status
def write_multiple_registers(self, slave_addr, starting_address, register_values, signed=True): modbus_pdu = functions.write_multiple_registers(starting_address, register_values, signed) response = self._send_receive(slave_addr, modbus_pdu, False) operation_status = functions.validate_resp_data(response, Const.WRITE_MULTIPLE_REGISTERS, starting_address, quantity=len(register_values)) return operation_status
def write_single_register(self, slave_addr, register_address, register_value, signed=True): modbus_pdu = functions.write_single_register(register_address, register_value, signed) response = self._send_receive(slave_addr, modbus_pdu, False) operation_status = functions.validate_resp_data(response, Const.WRITE_SINGLE_REGISTER, register_address, value=register_value, signed=signed) return operation_status