def setRelay(self, seconds, relay, status, password="<STR_LIT>"):
result = False<EOL>self.setContext("<STR_LIT>")<EOL>try:<EOL><INDENT>self.clearCmdMsg()<EOL>if len(password) != <NUM_LIT:8>:<EOL><INDENT>self.writeCmdMsg("<STR_LIT>")<EOL>self.setContext("<STR_LIT>")<EOL>return result<EOL><DEDENT>if seconds < <NUM_LIT:0> or seconds > <NUM_LIT>:<EOL><INDENT>self.writeCmdMsg("<STR_LIT>")<EOL>self.setContext("<STR_LIT>")<EOL>return result<EOL><DEDENT>if not self.requestA():<EOL><INDENT>self.writeCmdMsg("<STR_LIT>")<EOL><DEDENT>else:<EOL><INDENT>if not self.serialCmdPwdAuth(password):<EOL><INDENT>self.writeCmdMsg("<STR_LIT>")<EOL><DEDENT>else:<EOL><INDENT>req_str = "<STR_LIT>"<EOL>req_str = ("<STR_LIT>" +<EOL>binascii.hexlify(str(relay)).zfill(<NUM_LIT:2>) +<EOL>"<STR_LIT>" +<EOL>binascii.hexlify(str(status)).zfill(<NUM_LIT:2>) +<EOL>binascii.hexlify(str(seconds).zfill(<NUM_LIT:4>)) + "<STR_LIT>")<EOL>req_str += self.calc_crc16(req_str[<NUM_LIT:2>:].decode("<STR_LIT>"))<EOL>self.m_serial_port.write(req_str.decode("<STR_LIT>"))<EOL>if self.m_serial_port.getResponse(self.getContext()).encode("<STR_LIT>") == "<STR_LIT>":<EOL><INDENT>self.writeCmdMsg("<STR_LIT>")<EOL>result = True<EOL><DEDENT><DEDENT><DEDENT>self.serialPostEnd()<EOL><DEDENT>except:<EOL><INDENT>ekm_log(traceback.format_exc(sys.exc_info()))<EOL><DEDENT>self.setContext("<STR_LIT>")<EOL>return result<EOL>
Serial call to set relay.

        Args:
            seconds (int): Seconds to hold, ero is hold forever. See :class:`~ekmmeters.RelayInterval`.
            relay (int): Selected relay, see :class:`~ekmmeters.Relay`.
            status (int): Status to set, see :class:`~ekmmeters.RelayState`
            password (str): Optional password

        Returns:
            bool: True on completion and ACK.