connect function

Future<ConnectionInfo> connect ()

Connects with the JMB Aqualight controller.

Make sure that you are connected to the controller's WiFi network.

Throws an error if the controller cannot be reached.

Implementation

Future<ConnectionInfo> connect() async {
  final packets = [createDiscoveryPacket()];
  final response = await sendPackets(packets);
  final controllerId = response[0].substring(8, 32);
  return ConnectionInfo(controllerId);
}