getScenario method

Future<SetScenarioResponse> getScenario(
  1. String address,
  2. int sceneID, {
  3. int output = 0,
  4. int timeout = kScenarioCmdTimeout,
})

Will request for the description of the scenario that has the given sceneID

Implementation

Future<SetScenarioResponse> getScenario(
  String address,
  int sceneID, {
  int output = 0,
  int timeout = kScenarioCmdTimeout,
}) async {
  if (sceneID < 0 || sceneID > 510) {
    throw RangeError.range(sceneID, 0, 510, 'sceneID');
  }
  _checkValidAddress(address, shouldCheckGroupFormat: false);
  final r = Random();
  final correlation = int.parse(address, radix: 16) + r.nextInt(1 << 15);
  return SetScenarioResponse.fromJson(await _sendRequest(
    'set_scenario',
    params: <String, dynamic>{
      'node_address': address,
      'request': {
        'command': 'get scenario',
        'scenario_id': sceneID,
        'io': output,
        'correlation': correlation,
      },
      'timeout': timeout,
    },
  ));
}