diff --git a/examples/all-clusters-app/esp32/main/DeviceCallbacks.cpp b/examples/all-clusters-app/esp32/main/DeviceCallbacks.cpp index 128b4b66b1a024..ac1f35ba41f23a 100644 --- a/examples/all-clusters-app/esp32/main/DeviceCallbacks.cpp +++ b/examples/all-clusters-app/esp32/main/DeviceCallbacks.cpp @@ -282,7 +282,7 @@ void DeviceCallbacks::OnIdentifyPostAttributeChangeCallback(EndpointId endpointI else { bool onOffState; - endpointId == 0 ? onOffState = mEndpointOnOffState[0] : onOffState = mEndpointOnOffState[endpointId - 1]; + bool onOffState = mEndpointOnOffState[endpointId == 0 ? 0 : endpointId - 1]; endpointId == 2 ? statusLED2.Set(onOffState) : statusLED1.Set(onOffState); } }