requestState method

Future<void> requestState()

Request the current state of the switch. Return true if the request was successful, else false.

Implementation

Future<void> requestState() async {
  var report = await commandHandler!.request(ZwRequest<SwitchBinaryReport>(
    logger,
    id,
    buildSendDataRequest(id, [
      COMMAND_CLASS_SWITCH_BINARY,
      SWITCH_BINARY_GET,
    ]),
    processResponse: (data) => SwitchBinaryReport(data),
    resultKey: SwitchBinaryReport,
  ));
  stateValue = report.value;
  state = stateValue! > 0;
}