toBridgeObject method

  1. @override
Map toBridgeObject({
  1. String? action,
})

Implementation

@override
Map toBridgeObject({String? action}) {
  if ('create' == action) {
    return {
      'name': name,
      'recycle': recycle ?? false,
      'lights': lightIds!.toList()
    };
  } else if ('attributes' == action) {
    final body = {};
    if (name != null) {
      body['name'] = name;
    }
    if (lightIds != null) {
      body['lights'] = lightIds!.toList();
    }
    return body;
  }
  return {};
}