docs: def send_code(self, data, acknowledge=True):
          """Send a RF code known to the pilight-daemon.
  
          For protocols look at https://manual.pilight.org/en/api.
          When acknowledge is set, it is checked if the code was issued.
          :param data: Dictionary with the data
          :param acknowledge: Raise IO exception if the code is not
          send by the pilight-deamon
          """
          if "protocol" not in data:
              raise ValueError(
                  'Pilight data to send does not contain a protocol info. '
                  'Check the pilight-send doku!', str(data))
  
          # Create message to send
          message = {
              "action": "send",  # Tell pilight daemon to send the data
              "code": data,
          }
  
          # If connection is closed IOError is raised
          self.send_socket.sendall(json.dumps(message).encode())
  
          if acknowledge:  # Check if command is acknowledged by pilight daemon
              messages = self.send_socket.recv(1024).splitlines()
              received = False
              for message in messages:  # Loop over received messages
                  if message:  # Can be empty due to splitlines
                      acknowledge_message = json.loads(message.decode())
                      # Filter correct message
                      if ('status' in acknowledge_message and
                              acknowledge_message['status'] == 'success'):
                          received = True
              if not received:
                  raise IOError('Send code failed. Code: %s', str(data))