diff --git a/smart-light/Matter/Matter.swift b/smart-light/Matter/Matter.swift index 049e258..0feacf2 100644 --- a/smart-light/Matter/Matter.swift +++ b/smart-light/Matter/Matter.swift @@ -140,7 +140,7 @@ extension Matter { var lightConfig = esp_matter.endpoint.extended_color_light.config_t() lightConfig.on_off.on_off = true lightConfig.level_control.current_level = .init(64) - lightConfig.level_control.lighting.start_up_current_level = .init(64) + lightConfig.level_control_lighting.start_up_current_level = .init(64) lightConfig.color_control.color_mode = chip.app.Clusters.ColorControl.ColorMode.colorTemperature.rawValue lightConfig.color_control.enhanced_color_mode = diff --git a/smart-light/Matter/Node.swift b/smart-light/Matter/Node.swift index d8a84b8..111f739 100644 --- a/smart-light/Matter/Node.swift +++ b/smart-light/Matter/Node.swift @@ -114,11 +114,14 @@ struct Endpoint: MatterEndpoint { } func `as`(_ type: T.Type) -> T? { - var count = UInt8(0) let expected = T.deviceTypeId - let ids = esp_matter.endpoint.get_device_type_ids(endpoint, &count) - for id in UnsafeMutableBufferPointer(start: ids, count: Int(count)) { - if id == expected { + let count = esp_matter.endpoint.get_device_type_count(endpoint) + for i in 0..